In Computer Systems: a Programmer's Perspective:
Writing TMin in C In Figure 2.19 and in Problem 2.21, we carefully wrote the value of TMin32 as -2,147,483,647-1. Why not simply write it as either -2,147,483,648 or 0x80000000? Looking at the C header ﬁle limits.h, we see that they use a similar method as we have to write TMin32 and TMax32:
/* Minimum and maximum values a ‘signed int’ can hold. */ #define INT_MAX 2147483647 #define INT_MIN (-INT_MAX - 1)
Unfortunately, a curious interaction between the asymmetry of the two’s-complement representation and the conversion rules of C forces us to write TMin32 in this unusual way. Although understanding this issue requires us to delve into one of the murkier corners of the C language standards, it will help us appreciate some of the subtleties of integer data types and representations.
0x80000000 is a hexadecimal notation, and is in the range of signed int, isn't it? (How do you tell if an integer integral is signed or unsigned? Isn't it that an integer literal without any suffix by default is a signed integer? So 0X80000000 is signed? It is in the range of signed, because it is the smallest integer in the signed range)
#define INT_MIN 0x80000000 be okay, while the book says otherwise?