‹ BackHN Continuity

Thread

C's Flexible Integer Sizes Were Not a Design Mistake

113 points · 166 comments · ibobev

  1. usrnm · · focus · HN ↗
    But not having fixed size integers (or integers tied to the size of a pointer) was. Both can be useful
    1. tialaramex · · focus · HN ↗
      It turns out that you don't want integers the same size as a pointer because somebody might squirrel away capability bits in your pointer type (see CHERI) and you definitely do not want integers with capability bits.

      Rust originally says that its types usize and isize are the same size as pointers, but this was ret-conned in later Rust to say actually they're the same size as addresses for this reason.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.