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

后端 未结 6 1797
醉酒成梦
醉酒成梦 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:25

    d 32-bit microcomputers define "char" as 8 bits, "short" as 16 bits, and "long" as 32 bits. The only difference among them is whether "int" is 16 bits or 32.

    While a 32-bit or larger CPU could use "int" as a 32-bit type, leaving "long" available as a 64-bit type, there is a substantial corpus of code which expects that "long" will be 32 bits. While the C Standard added "fixed-sized" types in 1999, there are other places in the Standard which still use "int" and "long", such as "printf". While C99 added macros to supply the

提交回复
热议问题