On Sun, 13 Jul 2003, Erik Trulsson wrote: > On Sun, Jul 13, 2003 at 01:37:32PM -0500, David Leimbach wrote: > > You keep saying this... where is this "must behave as two's compliment > > stated?" > > > > >(unsigned int) -1 == 0xffffffff (assuming 32-bit int). > > > > or with a valid one's compliment C99 compliant system > > (unsigned int) -1 = 0xfffffffe; > Only if UINT_MAX happens to be0xfffffffe, which it probablky won't be. Probabilty zero on C99 conformant systems :-). UFOO_MAX is (2^N - 1) where N is the number of value bits in the representation of type FOO. See 6.2.6.2. (UFOO_MAX may still be represented differently in memory than as N lower bits all set.) [Someone wrote] > > >even on a one's complement's machine, without the standard conversion, > > >the 'type punning' conversion of -1 would yield 0xfffffffe, which is > > >still > 0. > > > > > Correct :). I still don't think C enforces two's compliment. I don't think there is any requirement that the layout of the bits in representations of unsigned types has anything to do with the layout for signed types, so type punning might set implementation-specific wrong {value, trap, padding} bits. BruceReceived on Sun Jul 13 2003 - 12:07:10 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:15 UTC