‹ BackHN Continuity

Thread

C's Flexible Integer Sizes Were Not a Design Mistake

113 points · 166 comments · ibobev

  1. RobotToaster · · focus · HN ↗
    > A 'plain' int object has the natural size suggested by the architecture of the execution environment.

    Shouldn't they be 64 bits on most modern systems then?

    1. Alpha3031 · · focus · HN ↗
      Memory addresses being 64 bits due to needing to address more than 4 GiB memory doesn't mean most integer instructions operate most efficiently with 64 bits. Instructions for 32 bit integers are still more efficient than 64 bit, whereas 16 bit operands require a prefix byte meaning they're less compact and cache efficient (on AMD64 anyway).
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.