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 -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -