------- Comment #7 from lukew at radterm dot com dot au 2006-10-27 03:51 ------- (In reply to comment #6) > Subject: Re: hex and oct constants are converted to wrong type > > lukew at radterm dot com dot au wrote:- > > > > The resulting tokens compose the controlling constant expression which > > > is evaluated according to the rules of 6.6. For the purposes of this > > > token conversion and evaluation, all signed integer types and all > > > unsigned integer types act as if they have the same representation as, > > > respectively, the types intmax_t and uintmax_t defined in the header > > > <stdint.h>.142) > > > > > > 142) Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is > > > 0xFFFF, the constant 0x8000 is signed and positive within a #if > > > expression even though it would be unsigned in translation phase 7. > > > > > > > I don't get it. > > > > How can 0x8000 be signed AND positive when INT_MAX is a 16 bit integer? > > Ask yourself what its type is. >
intmax_t and INTMAX_MAX is 0x7FFFFFFFFFFFFFFF. 0x8000000000000000 is unsigned where as (INTMAX_MAX + 1) is signed and negative. Which is fine. Thanks Neil. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27195