You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
587 B

25 years ago
25 years ago
25 years ago
  1. // offsetof() and friends
  2. // <stddef.h> in GCC 3.0/3.1 has the obscure property of redefining
  3. // offsetof every time it is included, not just the first time.
  4. // Therefore we do the same thing here, and make sure that this file
  5. // gets included after each include of <stddef.h>.
  6. #undef offsetof
  7. #if defined(__GNUG__)
  8. #define offsetof(type,ident) ((long)&(((type*)1)->ident)-1)
  9. #else
  10. #define offsetof(type,ident) ((long)&(((type*)0)->ident))
  11. #endif
  12. #ifndef _CL_OFFSETOF_H
  13. #define _CL_OFFSETOF_H
  14. #define offsetofa(type,ident) offsetof(type,ident[0])
  15. #endif /* _CL_OFFSETOF_H */