Style guides and portability

Doug Gwyn gwyn at smoke.brl.mil
Wed Jan 16 09:06:07 AEST 1991


In article <1291 at mti.mti.com> adrian at mti.UUCP (Adrian McCarthy) writes:
>Who cares how many bits are used in the representation?  What really matters
>is the range of legal values.

That's what I was referring to.  I used the shorthand terminology for
brevity, on the assumption that everyone who cared would understand
the abbreviation.

>Yes, use limits.h.  But does "pure binary numeration system" imply that
>you can't make an ANSI-compliant C compiler for a BCD machine?

<limits.h> doesn't necessarily exist in non-ANSI C environments, which
many of us still have to contend with.  However, the guaranteed minimum
sizes apply whether or not <limits.h> is #included.

Certainly one could produce a conforming implementation on an inherently
BCD machine; however, care would have to be taken to ensure that bitwise
operations and unsigned arithmetic were properly implemented.  There is
no requirement that <limits.h> (for example) fully describe hardware
representation capabilities, merely the ranges officially constituting
the conforming implementation of the C standard.  Any application that
attempted to exploit values outside the official range would be non-
strictly conforming.



More information about the Comp.lang.c mailing list