common: use decltype to approximate typeof for C++. v0.0.70 v0.0.72 v0.0.73
authorKrisztian Litkey <krisztian.litkey@intel.com>
Tue, 16 Dec 2014 19:05:03 +0000 (21:05 +0200)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Tue, 16 Dec 2014 19:36:27 +0000 (21:36 +0200)
decltype looks good enough to approximate some usage of the
very handy gcc-compatible typeof extension. It does not seem
to be good enough to cover all cases (one known cas where it
breaks down is mrp_list_entry).

src/common/macros.h

index bee5741..78e8f1c 100644 (file)
 #    define TRUE (!FALSE)
 #endif
 
+#ifdef __cplusplus
+#  define typeof(expr) decltype(expr)
+#endif
+
 /** Align ptr to multiple of align. */
 #define MRP_ALIGN(ptr, align) (((ptr) + ((align)-1)) & ~((align)-1))