1 // offsetof() and friends
3 // <stddef.h> in GCC 3.0/3.1 has the obscure property of redefining
4 // offsetof every time it is included, not just the first time.
5 // Therefore we do the same thing here, and make sure that this file
6 // gets included after each include of <stddef.h>.
10 #define offsetof(type,ident) ((intptr_t)&(((type*)1)->ident)-1)
12 #define offsetof(type,ident) ((intptr_t)&(((type*)0)->ident))
15 #ifndef _CL_OFFSETOF_H
16 #define _CL_OFFSETOF_H
18 #define offsetofa(type,ident) offsetof(type,ident[0])
20 #endif /* _CL_OFFSETOF_H */