Skip to main content
5 events
when toggle format what by license comment
Mar 14, 2023 at 15:40 history edited gnasher729 CC BY-SA 4.0
edited body
Aug 25, 2016 at 9:07 comment added PaulHK I've never seen a C compiler re-order fields. I have seen many insert padding and alignment between chars/ints for example though..
Aug 21, 2016 at 20:37 comment added Sjoerd A C++ compiler may reorder fields under certain conditions only, which likely aren't met if you aren't aware of those rules. On top of that, I'm not aware of any C++ compiler that actually uses this freedom.
Aug 19, 2016 at 17:15 comment added greyfade Unaligned data happens in memory. Programs which don't have properly-packed data structures can suffer massive performance penalties for even a seemingly inconsequential ordering of values. In lthreaded code, for example, two values in a single cache line will cause massive pipeline stalls when two threads access them at the same time (ignoring the thread safety issues, of course).
Aug 19, 2016 at 14:50 history answered gnasher729 CC BY-SA 3.0