🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1112

Re: all bits zero?

#1112
From: bdm659
Date: Thu, 22 Mar 1990 16:51
22 lines
1470 bytes
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
Technical Details
Message-ID: <1780.26090275@csc.anu.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!csc!bdm659
References: <2108@gmdzi.UUCP> <1217@sdrc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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