< limits>的等价物和< climits> [英] Equivalence of <limits> and <climits>
问题描述
-
是否保证始终是这样:
Is this guaranteed to be always true:
std::numeric_limits<int>::max() == INT_MAX
C ++标准对此有何表述?我在标准中找不到任何可以明确说明这一点的参考,但是我一直在读那些参考应该是等效的.
What does C++ standard say about it? I could not find any reference in the standard that would explicitly state this, but I keep reading that those should be equivalent.
对于同时实现C99(至少为long long
部分)和C ++ 98的编译器,不是C ++ 98标准中的C99类型如何?我不确定这是否始终成立:
What about C99 types that are not in C++98 standard for compilers that implement both C99 (at least long long
part) and C++98? I am not sure whether there is any guarantee that this always holds true:
std::numeric_limits<unsigned long long>::max() == ULLONG_MAX
这是一个合理的假设吗?
Is this a reasonable assumption?
推荐答案
我的C ++ 2003标准副本表示numeric_limits<>::max()
和min()
模板将返回值:
My copy of the C++ 2003 standard says that the numeric_limits<>::max()
and min()
templates will return values:
等同于
CHAR_MIN, SHRT_MIN, FLT_MIN, DBL_MIN,
等.
等同于CHAR_MAX, SHRT_MAX, FLT_MAX, DBL_MAX,
等
但是,这些都在脚注中. ISO/IEC指令第3部分:"[脚注]不应包含要求."尽管可能需要表格或数字的脚注.
However, those are in footnotes. ISO/IEC Directives Part 3: "[Footnotes] shall not contain requirements." Though footnotes to tables or figures may be requirements.
这篇关于< limits>的等价物和< climits>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!