Print this page
3373 gcc >= 4.5 concerns about offsetof()

*** 41,52 **** */ #ifndef _ISO_STDDEF_ISO_H #define _ISO_STDDEF_ISO_H - #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ - #include <sys/isa_defs.h> #ifdef __cplusplus extern "C" { #endif --- 41,50 ----
*** 86,96 **** #endif /* end of namespace std */ #if __cplusplus >= 199711L #define offsetof(s, m) (std::size_t)(&(((s *)0)->m)) #else ! #define offsetof(s, m) (size_t)(&(((s *)0)->m)) #endif #ifdef __cplusplus } #endif --- 84,98 ---- #endif /* end of namespace std */ #if __cplusplus >= 199711L #define offsetof(s, m) (std::size_t)(&(((s *)0)->m)) #else ! #if defined(__GNUC__) ! #define offsetof(s, m) __builtin_offsetof(s, m) ! #else ! #define offsetof(s, m) ((size_t)(&(((s *)0)->m))) ! #endif #endif #ifdef __cplusplus } #endif