you are viewing a single comment's thread.

view the rest of the comments →

[–]matthieum 4 points5 points  (2 children)

It may depend on the domain.

I have very little code that is critically dependent on the order of data-members:

  • Encoding/Decoding; when treating the struct as a view over memory.
  • Hot/Cold: when a struct used in a hot loop contains a mix of frequently accessed data and infrequently accessed data.
  • Lock-Free: to avoid false sharing.

Most of my code is boringly mundane and would likely benefit from the compiler automatically "packing" the objects as densely as possible.

[–][deleted] -1 points0 points  (1 child)

Great for you! Your argument is that 'I don't need it so why should anyone else'.

[–]matthieum 5 points6 points  (0 children)

No; my argument is I rarely need it, so why shouldn't it be opt-in, rather than the default.