https://bugs.freedesktop.org/show_bug.cgi?id=64394

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |UNCONFIRMED
                 CC|                            |[email protected]
     Ever confirmed|1                           |0

--- Comment #3 from [email protected] ---
(In reply to comment #1)
> What is a problem you would want to solve with that change?
> 
> For type safety, it is generally better to support as few implicit
> conversions as possible (and we already support too many in the
> com::sun::star::uno::Any functionality, for my taste).

Generally speaking, I agree. In practice: having a wrapper for the Any type and
template methods forbidden, there are many methods, such as ToInt32(),
ToInt64(), ToBool(), ToUInt32() and so on. For each of them the code has
avoidable "if" and reinterpret_cast, if an implicit conversion for enum would
exist:

[...]
  *m_pAny >>= Value ;
  // hack to manage typelib_TypeClass_ENUM too - BEGIN
  if ( m_pAny->pType->eTypeClass == typelib_TypeClass_ENUM )
  {
      Value = *reinterpret_cast<const sal_Int32*>(m_pAny->pData);
  }
  // hack to manage typelib_TypeClass_ENUM too - END
[...]

Ok, for the custom type (e.g. Size) a cast is mandatory and convert it to Int32
or Bool makes no sense; instead enum is a common base type and it is very easy
to be converted to other numerical base types.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to