3 ms·
Wouldn't it make sense for the compiler to automatically optimize stuff like this? The compiler knows all about the underlying architecture the code will be ru
by Grishnakh 10y ago
Wouldn't it make sense for the compiler to automatically optimize stuff like this? The compiler knows all about the underlying architecture the code will be running on, so it's best positioned to determine how to order data for optimal efficiency.
- to3m 10y agoThe C rules don't permit it. Putting fields in the order specified is not the worst possible default. (The option would be nice, though... most of the time, you don't care.)
- nwmcsween 10y agoNo as you might be poking hardware and having the compiler at best make something not work or at worst brick hardware is not good. Compilers can earn on padding, most with -Wpadding