Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.lang.c Subject: Re: BSD bzero() & NULL Message-ID: <3764@skye.ed.ac.uk> Date: 15 Nov 90 15:58:10 GMT References: <1990Nov15.000129.27402@Think.COM> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 47 In article rjc@uk.ac.ed.cstr (Richard Caley) writes: >Does the standard demand that the bit pattern for then integer 0 be >`all zeros'. 3.1.2.5 (Types): The representation of integral types shall define values by use of a pure binary numeration system. [A footnote defines this as: A positional representation for integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, beginning with 1, and are multiplied by successive integral powers of 2, except perhaps the bit with the highest position.] In other words, yes. Or at least that's what they mean. I don't actually see anything that stops a system that's 2s-complement with the meaning of the sign bit reversed. I suppose it depends on the scope of the "except". The intention is to allow 2s and 1s complement. >Obviously all the standard operation would have to work (the bitwise >ones would be the killer). Section 3.3 (Expressions) specifically notes: These [bitwise] operators return values that depend on the internal representations of integers, and thus have implementation-defined aspects for signed types. >The only real way to tell the difference >would be to write some data raw to file and read it using some other >system. Since nothing is guaranteed about the external representation of data written to binary streams, you can't even do this. By the "as if" rule, the hardware could use ternary Gray code, so long as the compiler made the operators do the right thing. And if it did, there's nothing to stop it converting to and from 2s complement when doing binary i/o. -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin