[ros-diffs] [hyperion] 41519: Compilers other than GCC deserve offsetof, don't they?

hyperion at svn.reactos.org hyperion at svn.reactos.org
Sun Jun 21 23:40:38 CEST 2009


Author: hyperion
Date: Mon Jun 22 01:40:37 2009
New Revision: 41519

URL: http://svn.reactos.org/svn/reactos?rev=41519&view=rev
Log:
Compilers other than GCC deserve offsetof, don't they?

Modified:
    trunk/reactos/include/crt/stddef.h

Modified: trunk/reactos/include/crt/stddef.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/stddef.h?rev=41519&r1=41518&r2=41519&view=diff
==============================================================================
--- trunk/reactos/include/crt/stddef.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/stddef.h [iso-8859-1] Mon Jun 22 01:40:37 2009
@@ -287,7 +287,7 @@
    symbols in the _FOO_T_ family, stays defined even after its
    corresponding type is defined).  If we define wchar_t, then we
    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
-   we undef _WCHAR_T_, then we must also define rune_t, since 
+   we undef _WCHAR_T_, then we must also define rune_t, since
    headers like runetype.h assume that if machine/ansi.h is included,
    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
@@ -390,7 +390,11 @@
 #ifndef offsetof
 
 /* Offset of member MEMBER in a struct of type TYPE. */
+#if defined(__GNUC__)
 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t)&(((TYPE *)0)->MEMBER))
+#endif
 
 #endif /* !offsetof */
 



More information about the Ros-diffs mailing list