Structured Fortran - was Re: Self modifying code, lambda calculus
Eric Smith
spacewar at gmail.com
Thu Sep 24 00:22:59 CDT 2015
On Wed, Sep 23, 2015 at 8:30 AM, Jay Jaeger <cube1 at charter.net> wrote:
> An int just has to be able to store numbers of a certain magnitude.
> Same with long. You do have to be able to convert between longs (and
> possibly ints) and addresses (*). So, you make an int 5 digits (which
> matches the natural length of addresses) and longs something like 10
> digits. You don't have to simulate anything, near as I can tell. Then
> the length of an int is 5 and a long is 10 (instead of the more typical
> 2 and 4).
And the length of a char? It's required that all types other than
bitfields be fully represented as multiple chars, not e.g. an int
being two and a half chars, and a char has to cover at least the range
0..255, or -128..127, and it has to have a range based on a power of
two.
ISO/IEC 9899:1999(E) §3.6 ¶1 - a byte has to hold any member of the
basic character set
ISO/IEC 9899:1999(E) §3.7.1 ¶1 - a character is a C bit representation
that fits in a byte
ISO/IEC 9899:1999(E) §5.2.4.2.1 ¶1 - the size of a char is CHAR_BIT
bits, which is at least 8
ISO/IEC 9899:1999(E) §6.2.6.1 ¶2-4 - everything other than bitfields
consists of bytes
ISO/IEC 9899:1999(E) §6.2.6.1 ¶5 - Some data types other than char may
have machine representations that can't use all of the possible bit
patterns of the storage allocated; those representations are called
"trap representations". The char (and unsigned char) types can't have
trap representations.
ISO/IEC 9899:199(E) §6.2.6.2 ¶1 - unsigned integer types must have a
range of 0 to (2^n)-1, for some natural number n.
ISO/IEC 9899:199(E) §6.2.6.2 ¶2 - signed integer types must have a
range of -(2^n) to (2^n)-1 or -((2^n)-1) to (2^n)-1.
On a decimal machine, if you use three digits for a char, you have to
arrange that all your other types are multiples of three digits, with
each three-digit group only using valid char representations, because
accessing a char/byte out of a larger integer type is not allowed to
be a trap representation, because chars can't have a trap
representation.
If an unsigned char is three digits with values from 0..255, an
unsigned int can't be five digits. It has to be six digits, and the
only valid representations for it would have values of 0..65535. It
can't have any valid values in the range of 65536..999999.
More information about the cctalk
mailing list