Simplicity
January 30, 2012 6 Comments
How would you define an unsigned int of 32 bits (you can imagine about 64 bits) to be infinite?
some might
const unsigned int kMaxUnsignedInt = 0xFFFFFFFF;
Others (shifting lovers) may
const unsigned int kMaxUnsignedInt = (((1<<30) - 1) << 2 ) | 3;
Few may
const unsigned int kMaxUnsignedInt = ~0;
I did
const unsigned int kMaxUnsignedInt = -1;
What would you do?
On a side note
What would the following code do?
const unsigned int kMaxUnsigndInt = (1<<31) - 1;


Recent Activity