Fix: headers: make static inline upcasts compatible with C++
[babeltrace.git] / include / babeltrace / types.h
index 9f71793a1b4b095f73f60bf2132e6a2083daec90..12b35f602445698b99e544c7919dbe3b3e8fda9f 100644 (file)
 
 #include <stdint.h>
 
+/* Internal use */
+#ifdef __cplusplus
+# define __BT_UPCAST(_type, _p)                static_cast<_type *>(static_cast<void *>(_p))
+# define __BT_UPCAST_CONST(_type, _p)  static_cast<const _type *>(static_cast<const void *>(_p))
+#else
+# define __BT_UPCAST(_type, _p)                ((_type *) (_p))
+# define __BT_UPCAST_CONST(_type, _p)  ((const _type *) (_p))
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
This page took 0.022857 seconds and 4 git commands to generate.