c++ - Is it possible to manually calculate the byte-offset of a class member? -



c++ - Is it possible to manually calculate the byte-offset of a class member? -

that is, standard compiler uses generate class? example, let's have class c members x, y, , z, , want know offset of z within class. can add together data-type sizes of other members, structure?

no cannot. compilers free align members chose to.it implementation detail of compilers.

if you're working pod, can utilize offsetof macro.

but if working non-pod, suppose there won't portable method so.

c++ compiler-construction class-members

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -