INT_[MIN|MAX] limit macros vs numeric_limits

后端 未结 5 623
故里飘歌
故里飘歌 2020-12-16 15:41

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

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 15:55

    If C++, use numeric_limits, end of.

    EDIT: 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...

    I guess my point is that the numeric_limits template is more useful beyond max() and min()...

提交回复
热议问题