[K42-discussion] [PATCH] Added another ifdef->undef for offsetof which gets
Paul H. Hargrove
PHHargrove at lbl.gov
Tue Oct 3 12:24:22 EST 2006
The C99 spec requires offsetof() to be #defined in <stddef.h>, which is
the same place it requires NULL to be #defined. For all recent gcc
versions, stddef.h is in the complier-specific header directory that
Michal mentions.
The Oct-2005 C++ draft standard says that <cstddef> has the same
contents as C's <stddef>, with some exceptions. Those exceptions limit
what on what types one can invoke offsetof(), but the spec still says
<cstddef> is the proper location for both NULL and offsetof(). As with
<stddef.h>, g++ appears to ship <cstddef> in a compiler-specific
subdirectory.
-Paul
Michal Ostrowski wrote:
>I'd like to emphasize that not only should this be in a header, it
>should be in a very low-level header; something that is going to be
>picked up everywhere. Linux has such mechanisms by having compiler
>specific headers that are picked-up at a very low leve,
>
>
>
--
Paul H. Hargrove PHHargrove at lbl.gov
Future Technologies Group
HPC Research Department Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory Fax: +1-510-486-6900
More information about the K42-discussion
mailing list