As far as I know, it should always be, POD class or not. At compile time, based on the compiler, architecture, settings, etc., the Compiler determines the size of the class and the offsets of all its members. Then it is fixed for all instances of the class in the compilation module (and by extension of the associated module if the rule of one definition is saved).
Since the compiler treats type pointers literally, even if the base type is wrong (for example: the pointer was incorrectly entered in c-style), the calculated distance between & foo and & (foo.bar) will be the same, since the offset is known statically at compile time .
Note. This was done, first of all, effectively. See, for example, Microsoft ATL data binding code using the "offsetof" macro ...
Nick
source share