zcranberry吧 关注:11贴子:1,613
  • 1回复贴,共1
In Figure 2.18 and in Problem 2.21, we carefully wrote the value of TMin32as -2147483647-1 .Whynot simply write it as either -2147483648 or 0x80000000? Looking at the C header filelimits.h,wesee that they use a similar method as we have to write TMin32and 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 representationand the conversion rules of C force us to write TMin32in this unusual way. Although understandingthis issue requires us to delve into one of the murkier corners of the C language standards, it will helpus appreciate some of the subtleties of integer data types and representations


1楼2012-08-24 21:08回复
    lzsb
    


    IP属地:加拿大2楼2012-08-26 10:56
    回复