INT_ [MIN | MAX] limit宏与numeric_limits< T> [英] INT_[MIN|MAX] limit macros vs numeric_limits<T>
问题描述
是否有任何参数使用数字限制宏(例如INT64_MAX)std :: numeric_limits?从我的理解,numeric_limits是在标准,但宏只有在C99所以非标准。
Is there any argument for using the numeric limits macros (e.g. INT64_MAX) over std::numeric_limits? From what I understand numeric_limits is in the standard but the macros are only in C99 so therefore non-standard.
推荐答案
使用 numeric_limits
,结束。
编辑:好的,根据詹姆斯的评论,不是结束。 - 异常是模板和案例标签。但是,我看不到有一个case标签为min或max,或者一个模板的用途,但我想我没有看到所有的可能性...
Okay, per the comment by James, not "end of." - exceptions are templates and case labels. But, I cannot see a use for having a case label for either min or max, or a template for them, but I guess I've not seen all possibilities...
我想我的观点是 numeric_limits
模板在 max()
和 min()
...
I guess my point is that the numeric_limits
template is more useful beyond max()
and min()
...
这篇关于INT_ [MIN | MAX] limit宏与numeric_limits< T>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!