Hexadecimal/octal constants

Chris Torek torek at elf.ee.lbl.gov
Thu Mar 21 07:49:50 AEST 1991


In article <RJOHNSON.91Mar20091144 at olorin.shell.com> rjohnson at shell.com
(Roy Johnson) writes:
>Is it true on every platform that 0xf == 15?

Yes.

>Is it also true on every platform that for bitwise operations, C
>behaves as if it is on a two's complement machine,

No.

>so that, e.g., the result of 0xf & 0x2 is 0x2 ...

Yes.  This latter is guaranteed because both 15 and 2 are positive.

Values of type <unsigned T> (where T is any valid type) *are* `pure
binary'; other integral values `act like' pure binary as long as they
are nonnegative.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list