On Wed, 23 Sep 2015, Eric Smith wrote:
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 . . .
ISO/IEC 9899:1999(E) ?3.7.1 ?1 . . .
ISO/IEC 9899:1999(E) ?5.2.4.2.1 ?1 . . .
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
ISO/IEC 9899:199(E) ?6.2.6.2 ?1 - unsigned integer types must have a
ISO/IEC 9899:199(E) ?6.2.6.2 ?2 - signed integer types must have a
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.
The original "challenge" just said "C".
THAT is all ANSI C.
K&R C did not have those limitations. If you wanted to build a C with a 7
bit short, a 13 bit int, and a 19 bit long, it was OK.
Only limits were that the sizeof an int couldn't be smaller than the size
of a short, sizeof a long couldn't be less than that of an int, etc.
I am not claiming that I could create a C compiler for 1401/1410, but
these restrictions only preclude ANSI C.
Note: I am also not saying that doing so would be a good idea.