Mehdi Akiki

Posts tagged "memory layout"

  • Published on

    Investigation · Part 6 of 10 · Types under the hood

    Where a Type Becomes a Layout: Fields, Padding, and Reordering

    The same three fields take 8 bytes in Rust and 12 in C, because rustc reorders them and C does not. I measured both, plus repr(C) and repr(packed), and this is the one place where a type leaves a physical trace the processor can touch.