(C++) Where does offsetof come from?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I'm trying to figure out where the offsetof macro is
defined?  The following code:

// Begin code
#include <iostream.h>
#ifdef offsetof
#define foo 13
#define foo 14
int main( )
{ cout << "foo = " << foo << endl; }
// End code

prints 13 so it would seem that there is an offsetof
macro defined somewhere.  The only one I can find is
in /usr/include/linux/stddef.h but (A) according to
the output of g++ -v, this directory isn't in my
include path and (B) even if it were, I'm not
#including the file.  Additionally, if I call offsetof
and run g++ -E it seems as though no substitution has
taken place.  I would suspect that the offsetof
support is built right into the compiler but if that
were the case, shouldn't the code above print 14?  I'm
using g++ version 3.2.3.  If anyone could shed some
light upon where sizeof if defined I'd really
appreciate it.  


Do you Yahoo!? 
All your favorites on one personal page ? Try My Yahoo!

Redhat-devel-list mailing list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux