UINT64_MAX
is defined in <cstdint>: https://en.cppreference.com/w/cpp/header/cstdint.
This is what I've always used. However, I see C++ provides this alternative as well:
std::numeric_limits<uint64_t>::max()
(see: https://en.cppreference.com/w/cpp/types/numeric_limits/max), which is part of the many numeric limits options defined in the <limits> header: https://en.cppreference.com/w/cpp/types/numeric_limits.
The C++ version seems overly verbose to me and appears to have no benefits. I assume it's included simply to be thorough, since they were adding additional functionality via other numeric_limits<> created in C++, but wanted to cover everything, I imagine, while they were at it.
Is there any benefit of using the C++-only version (std::numeric_limits<uint64_t>::max()) over the C or C++ version (UINT64_MAX)?
I'd really prefer the UINT64_MAX version, but in general find a lot of pushback from hard-core C++ developers whenever they see me write something in C++ which also would be valid in C. :)
Note: I haven't had pushback on this one yet, but I'd like some insight first to see if there is something I'm missing which truly makes one version better than the other.
Update: here's my own answer:
I'm not too happy this question was closed literally in the very same second as I pressed the submit button to add my own answer, but here's my own answer to this question:
As @Bob__ pointed out in the comments under the question, std::numeric_limits<uint64_t>::max() is really preferred when writing a C++ template where the uint64_t part needs to be replaced with the typename T.
However, if not in a template, it seems to me UINT64_MAX would be preferred since it's short, straight-to-the-point, less verbose, and easier to read.