Print this page
3373 gcc >= 4.5 concerns about offsetof()
Portions contributed by: Igor Pashev <pashev.igor@gmail.com>

@@ -78,15 +78,19 @@
 
 #if __cplusplus >= 199711L
 }
 #endif /* end of namespace std */
 
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+#define offsetof(s, m) __builtin_offsetof(s, m)
+#else
 #if __cplusplus >= 199711L
 #define offsetof(s, m)  (std::size_t)(&(((s *)0)->m))
 #else
 #define offsetof(s, m)  (size_t)(&(((s *)0)->m))
 #endif
+#endif  /* GNUC, etc. */
 
 #ifdef  __cplusplus
 }
 #endif