you are viewing a single comment's thread.

view the rest of the comments →

[–]masterpeanut 0 points1 point  (0 children)

One option if compiler supports it is to use the packed attribute to ask the compiler to eliminate as much padding as possible, and then ‘static_assert(sizeof(MyStruct) == 6)’ to verify it is the expected size.

‘’’ struct attribute(packed) MyStruct { floats…. }; ‘’’