Re:The Lost Art of Structure Packing (2018)
by virgilp on Monday April 27, 2020 @01:06PM
(#22997688)
I know, it wasn't obvious to me that elteto talked exclusively about C/C++. AFAIK few -if any- compilers/VMs take it upon themselves to reorder struct members (even outside C/C++ world).
[ Parent
| on HN ]
Re:The Lost Art of Structure Packing (2018)
by saagarjha on Tuesday April 28, 2020 @01:23AM
(#23003679)
Both Swift and Rust have an unspecified structure ordering by default, which almost always boils down to "the compiler will lay them out in the order specified, except if you leave enough padding to fit a member, in which case it'll reorder the elements for you".
Re:The Lost Art of Structure Packing (2018)
by leni536 on Monday April 27, 2020 @01:25PM
(#22997876)
Even though struct member reordering is prohibited, the order of std::tuple elements are not fixed by the standard. There could be an stdlib implementation that used this fact to reorder tuple members optimally.
AFAIK there are PoC 3rd party implementations for such tuples.