< limits>的等价物和< climits> [英] Equivalence of <limits> and <climits>

查看:74
本文介绍了< limits>的等价物和< climits>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 是否保证始终是这样:

  1. 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.

这篇关于&lt; limits&gt;的等价物和&lt; climits&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆