Is there a way of finding the offset of a member of a structure at compile-time? I wish to create a constant containing the offset of a structure member. In the following co
It compiles without warning here with g++ 4, after I add the proper #includes.
Are you #including stddef.h? offsetof() is a macro, not a built-in keyword in C.
If that doesn't fix it, try making the constant static, to confine it to the module. That might make the compiler happy.