Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!csc!bdm659 From: bdm659@csc.anu.oz Newsgroups: comp.std.c Subject: Re: all bits zero? Message-ID: <1780.26090275@csc.anu.oz> Date: 22 Mar 90 16:51:01 GMT References: <2108@gmdzi.UUCP> <1217@sdrc.UUCP> Organization: Computer Services, Australian National University Lines: 22 In article <1217@sdrc.UUCP>, scjones@sdrc.UUCP (Larry Jones) writes: > In article <2108@gmdzi.UUCP>, wittig@gmdzi.UUCP (Georg Wittig) writes: >> Does ANSI C require that in the internal representation of the integer constant >> ``0'' all bits are zero? > > ANSI C requires a pure binary numeration system for all integral > types, so "yes". [... and similar answers from lots of other people] I think you are all wrong. The implementation must only behave *as if* integral types are represented in binary. Integers might in fact be stored in packed-decimal or something; if conforming programs can't tell the difference, it doesn't matter. Such an implementation is going to have to work hard to do bitwise operations, for example, but that's not the issue. I think the correct answer to the original question is: "Zero can be stored any way the compiler-writer felt like it. However, you won't be able to write an ANSI-conforming program which can tell that it isn't stored in binary with all bits zero." Brendan McKay. bdm@anucsd.oz.au or bdm659@csc1.anu.oz.au