Taking offset of a data member is as easy as this:
#define MEMBER_OFFSET(Type, Member) \
((unsigned long)(((char *)&((Type *)0)->Member) - (char *)0));
I want to make this a constant compile-time expression (or use type traits). For example, to use it to implement SFINAE based solutions using member offsets, use it static assertions etc.
UPDATE: The question is - how to make it a compile-time expression. Not whether it works with POD types, or is there a standard macro in C library etc.