Do I have the guarantee that sizeof(type) == sizeof(unsigned type)?

后端 未结 2 1989
栀梦
栀梦 2020-12-18 18:14

The sizeof char, int, long double... can vary from one compiler to another. But do I have the guarantee according to the C++11 or C11 standard that the size of any signed an

2条回答
  •  我在风中等你
    2020-12-18 18:37

    Yes, there is a full guarantee that sizeof(signed type) is equal to sizeof(unsigned type) since unsigned is only taking the space of negative numbers of signed type to increase its range.

提交回复
热议问题