4 ms·
Sounds fragile, C++ compilers are permitted to do struct padding essentially as they please. A change in compiler could break the SSD<-->struct mapping (i.e. th
by MaxBarraclough 3y ago
Sounds fragile, C++ compilers are permitted to do struct padding essentially as they please. A change in compiler could break the SSD<-->struct mapping (i.e. the member offsets).
C++ arrays, on the other hand, are guaranteed not to have padding. That's essentially what memory-mapped IO gives you out of the box.
https://stackoverflow.com/a/5398498 https://stackoverflow.com/a/5398498
http://www.catb.org/esr/structure-packing/#_structure_alignment_and_padding http://www.catb.org/esr/structure-packing/#_structure_alignm...
- lights0123 3y agoI'm not familiar with C++ rules (the linked answer seems very suspect to me, their argument being "if you change the struct, the struct changes!"), but they could absolutely just be declaring them as extern "C" to use C's layout rules.