Mehdi Akiki

Posts tagged "c"

  • 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.
  • Published on

    Investigation · Part 1 of 10 · Types under the hood

    What Is a Type? A Set of Values, a Promise About Operations, or Both

    I took one small type, Human = man or woman, and compiled it in TypeScript, Rust, and C to see what stays of it. A type is a set of allowed values plus a set of allowed operations, both checked once, and neither reaches the processor.