SIZE_MAX and CHAR_BIT

Mar 9, 2013 at 9:31am
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
Mar 9, 2013 at 9:53am
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 Mar 9, 2013 at 9:54am
Topic archived. No new replies allowed.