I love an esoteric argument as much as the next person.
The proof is in the pudding, right?
So let’s try it.
In the code snippet:
long test0 = 9223372036854775806;
long poslimit = 9223372036854775807;
long posoverlimit = 9223372036854775808;
long neglimit = -9223372036854775807;
long negoverlimit = -9223372036854775808;
long negwayoverlimit = -9223372036854775809;
printf("test0 is %ld.\n", test0);
printf("poslimit is %ld.\n", poslimit);
printf("posoverlimit is %ld.\n", posoverlimit);
printf("neglimit is %ld.\n", neglimit);
printf("negoverlimit is %ld.\n", negoverlimit);
printf("negwayoverlimit is %ld.\n", negwayoverlimit);
The variables posoverlimit, negoverlimit, and negwayoverlimit are flagged with the warning:
“Integer constant is so large that it is unsigned”.
However, here are the results:
test0 is 9223372036854775806.
poslimit is 9223372036854775807.
posoverlimit is -9223372036854775808.
neglimit is -9223372036854775807.
negoverlimit is -9223372036854775808.
negwayoverlimit is 9223372036854775807.
Here’s a screenshot.
I haven’t gotten to the part of the book about warnings, so I don’t really understand the warnings.
But it seems that the limits are -9223372036854775808 through 9223372036854775807.