all bits zero?

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Mar 22 08:39:41 AEST 1990


In article <2108 at gmdzi.UUCP> wittig at gmdzi.UUCP (Georg Wittig) writes:
>Does ANSI C require that in the internal representation of the integer constant
>``0'' all bits are zero?

A "pure binary numeration system" is required for the representation of
integral types (that term is defined in the American National Dictionary
for Information Processing Systems), so that, other than possibly the
sign bit, all bits used to represent the value 0 must be 0.

>What about ``0x0'' (hex.) or ``0000'' (oct.)?

0x0==0 && 0000==0

They're not distinct types, just different ways of writing the value 0
in source code.

>If it IS allowed that in the internal representation not all bits are
>zero, is it then possible to write a #if expression that tests if all
>bits of the integer constant ``0'' are zero?

No, because the preprocessor is not required to use the same
representation as in the run-time environment.



More information about the Comp.std.c mailing list