In <sal/types.h> we have: /** Wrap C++ const_cast, reinterpret_cast and static_cast expressions in macros to keep code portable to old compilers (since most compilers still lack RTTI support, dynamic_cast is not included here). */ #ifdef __cplusplus #if defined SAL_W32 || defined SOLARIS || defined LINUX || defined MACOSX || \ defined FREEBSD || defined NETBSD || defined AIX || \ defined OPENBSD || defined DRAGONFLY #define SAL_CONST_CAST(type, expr) (const_cast< type >(expr)) #define SAL_REINTERPRET_CAST(type, expr) (reinterpret_cast< type >(expr)) #define SAL_STATIC_CAST(type, expr) (static_cast< type >(expr)) #else /* SAL_W32, SOLARIS, LINUX */ #define SAL_CONST_CAST(type, expr) ((type) (expr)) #define SAL_REINTERPRET_CAST(type, expr) ((type) (expr)) #define SAL_STATIC_CAST(type, expr) ((type) (expr)) #endif /* SAL_W32, SOLARIS, LINUX */ #endif /* __cplusplus */
Does the #else branch make any sense any more? Is there any OS for which the #else branch would be needed? And why do we test the OS here anyway, shouldn't we be testing the compiler and perhaps compiler version? Should this be simplified to always expand to the C++-style casts, and then an Easy Hack added to do the expansion inline so that we can get rid of the then pointless macros? (The lack of ANDROID and IOS in the test is just an oversight, I will add them there.) (SAL_REINTERPRET_CAST is not used anywhere, says opengrok, so that can be binned outright.) --tml _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice