MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1rc9yat/bitfield_layout/o6xy3nd/
r/cpp • u/mttd • Feb 23 '26
13 comments sorted by
View all comments
Show parent comment
6
The default behavior of adding padding by default is very sane. Otherwise you just obfuscate a very important part of how computer are working.
However I'm totally with you on the issue and we should have had a "flexible struct" for years now where order does not matter.
1 u/TheoreticalDumbass :illuminati: Feb 25 '26 would the compiler have freedom to arbitrarily change layout of the flexible struct? if so, you couldnt link object files produced by different compilers 2 u/kreco Feb 25 '26 Indeed! The "flexible" part needs to be deterministic and not arbitrary.
1
would the compiler have freedom to arbitrarily change layout of the flexible struct? if so, you couldnt link object files produced by different compilers
2 u/kreco Feb 25 '26 Indeed! The "flexible" part needs to be deterministic and not arbitrary.
2
Indeed! The "flexible" part needs to be deterministic and not arbitrary.
View all comments
Show parent comment
6
u/kreco Feb 23 '26
The default behavior of adding padding by default is very sane. Otherwise you just obfuscate a very important part of how computer are working.
However I'm totally with you on the issue and we should have had a "flexible struct" for years now where order does not matter.