gpt4 book ai didi

c++ - UINT_MIN 的可移植值是多少?

转载 作者:可可西里 更新时间:2023-11-01 15:37:13 25 4
gpt4 key购买 nike

limits.h 中,有 INT_MAXINT_MIN(以及 SHRT_* 和 LONG_* 等)的#defines,但是只有 UINT_MAX

我应该自己定义 UINT_MIN 吗? 0(正零)是可移植值吗?

最佳答案

它是一个无符号整数 - 根据定义,它的最小可能值为 0。如果你想要一些除了常识之外的理由,standard说:

6.2.6.2 Integer types

  1. For unsigned integer types other than unsigned char, the bits of the object representation shall be divided into two groups: value bits and padding bits (there need not be any of the latter). If there are N value bits, each bit shall represent a different power of 2 between 1 and 2^(N−1), so that objects of that type shall be capable of representing values from 0 to 2^(N−1) using a pure binary representation; this shall be known as the value representation. The values of any padding bits are unspecified.

关于c++ - UINT_MIN 的可移植值是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3499325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com