Is this the correct way to test for a maximum unsigned value in C and C++ code:
if(foo == -1) { // at max possible value }
where foo is
I would define a constant that would hold the maximum value as needed by the design of your code. Using "-1" is confusing. Imagine that someone in the future will change the type from unsigned int to int, it will mess your code.