Equivalence of <limits> and <climits>

c, c++, limits, standards, stl

Solution

My copy of the C++ 2003 standard says that the `numeric_limits<>::max()` and `min()` templates will return values:

Equivalent to `CHAR_MIN, SHRT_MIN, FLT_MIN, DBL_MIN,` etc.

Equivalent to `CHAR_MAX, SHRT_MAX, FLT_MAX, DBL_MAX,` etc

However, those are in footnotes. ISO/IEC Directives Part 3: "[Footnotes] shall not contain requirements." Though footnotes to tables or figures may be requirements.

Problem

Is this guaranteed to be always true: ``` std::numeric_limits<int>::max() == INT_MAX ``` 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. 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?

Original source