Hacker News new | ask | show | jobs
by vardump 2490 days ago
> For example, the Rust compiler can and does reorder fields in structs to improve packing.

Yikes! That can be disabled, right?

2 comments

Yeah, if you need "C" style struct representation (which guarantees order), you can enable that on a per-struct basis.
Use #[repr(C)] to force C-compatible layout.