Why do C compilers specify long to be 32-bit and long long to be 64-bit?

后端 未结 6 1800
醉酒成梦
醉酒成梦 2021-01-04 12:53

Wouldn\'t it have made more sense to make long 64-bit and reserve long long until 128-bit numbers become a reality?

6条回答
  •  遥遥无期
    2021-01-04 13:29

    For historical reasons. For a long time (pun intended), "int" meant 16-bit; hence "long" as 32-bit. Of course, times changed. Hence "long long" :)

    PS:

    GCC (and others) currently support 128 bit integers as "(u)int128_t".

    PPS:

    Here's a discussion of why the folks at GCC made the decisions they did:

    http://www.x86-64.org/pipermail/discuss/2005-August/006412.html

提交回复
热议问题