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

@@ -524,11 +524,15 @@
 
 /*
  * Yet another standard thing that is not standard ...
  */
 #ifndef offsetof
-#define offsetof(s, m)  ((size_t)(&((s *)0)->m))
+#if defined(__GNUC__)
+#define offsetof(s, m)  __builtin_offsetof(s, m)
+#else
+#define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
+#endif
 #endif
 
 /*
  * Build a 32bit rdc_set structure and copyout to the user level.
  */