From a standards standpoint, should I use the following from the C++ <limits> header?
UCHAR_MAX which is the c implementation or
std::numeric_limits<unsigned char>::max() which is the C++ implementation.
The result is equivalent between the two versions but should I choose an implementation based on some standard or on readability and portability in this case. Note this implementation must be cross-platform compatible. I am writing C++ code.
If you want the code to be able to compile as C, then you pretty much need to use
<limits.h>. If you’re writing C++, it’s probably better to use the C++<limits>header instead. The latter lets you write code that will work in templates that can’t really be duplicated with the C header: