If I compile following code
size_t a = -1;
with MSVC with W4 option I get
warning C4245: 'initializing': conversion from 'int' to 'size_t', signed/unsigned mismatch
and I am not 100% sure that -1 is 0xFFFFFFFF on all the platforms. Is -1 bit representation defined by the standard?
Other options are:
size_t a = std::numeric_limits<size_t>::max();
size_t a = static_cast<size_t>(-1);
Are there some other alternatives?
It can be uint8_t, uint16_t, etc...
And in the code above I do not know what is the actual size of size_t, it can be 4 bit or 8 bit, for example.