3 ms·
In the rearrange example, can/does the compiler do the rearrange, padding automatically?
by srcmap 12y ago
In the rearrange example, can/does the compiler do the rearrange, padding automatically?
- CJefferson 12y agoIn both C and C++ fields in structs must be outputted in the order they are listed. There is in C++ a freedom to rearrange fields whenever the user switches between public/private/protected, but I believe no compiler takes advantage of it, because (I believe) it is believed too suprising for these kinds of changes to change a class' size.