size guarantee for integral/arithmetic types in C and C++

前端 未结 7 2162
难免孤独
难免孤独 2020-12-15 00:49

I know that the C++ standard explicitly guarantees the size of only char, signed char and unsigned char. Also it gives guarantees that

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 01:02

    Just be careful about the fact that some machines have chars that are more than 8 bits. For example, IIRC on the TI C5x, a long is 32 bits, but sizeof(long)==2 because chars, shorts and ints are all 16 bits with sizeof(char)==1.

提交回复
热议问题