What should C++ programmers use, and why?
SIZE_MAX vs std::numeric_limits<std::size_t>::max()
CHAR_BIT vs std::numeric_limits<unsigned char>::digits
SIZE_MAX and CHAR_BIT is:
a) Created as a backward compatibility with C.
b) Reintroduced from C only in C++11 (May not work if compiler does not fully support C++11)
c) Is a macro constant.
I dont see why you shouldn't use numeric_limits. It is self descripting, won't conflict with other macro (user defined or not), and constexpr anyway.
Last edited on