Compilers other than GCC deserve offsetof, don't they?

svn path=/trunk/; revision=41519
This commit is contained in:
KJK::Hyperion 2009-06-21 21:40:37 +00:00
parent d38eca89a3
commit da2965ea12

View file

@ -390,7 +390,11 @@ typedef __WCHAR_TYPE__ wchar_t;
#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 */