In said:
Does anybody have the slightest clue how to get this thread on-topic?
Sure: just mention the conformance issues of its C compiler, according to
the K&R1 specification.
Unfortunately, the C compiler for my C64 is dead due to diskette
failure. It wasn't compliant to any standard anyway. Sigh.
The only 8-bit C implementation that was conforming to K&R1 that I have
used was Aztec C II for CP/M-80.
Hisoft C for ZX-Spectrum (the only C implementation for the Spectrum I'm
aware of) was ridden with conformance issue, WRT K&R1. The most important
ones were:
- No floating point support.
- long was a 16-bit type.
- Any cast had to be prefixed by the "cast" keyword.
- Casts and sizeof only accepted primary types or typedef'ed types. To
cast something to char *, you needed to do something like this:
typedef char *charp;
char *screen = cast(charp)16384;
- Initialisers not supported for automatics.
- No block scope identifiers (except for the outermost block of a
function definition).
The idea was to keep the compiler as small as possible, so that it could
be still used without a microdrive or disk. This means that the about
40K of available memory had to contain, *at the same time*, the following
things: the C compiler, the C runtime support (including most of the
standard library), the text editor, the source code of the C program,
the generated executable code, the compiler's internal tables.
It was possible to compile code directly from audio tape, but it was so
unpractical that it was mostly a theoretical possibility. Fortunately,
it was possible to write non-trivial programs without having to resort to
this "feature". The most complex program I wrote with everything in
memory was a tetris implementation.
Undefined behaviour basically meant that you had to reload everything
from audio tape (and redo the last unsaved changes to your code
The same penalty for entering an infinite loop.
And, of course, for anything real fun (graphics or sound) you had to
resort to inline machine code (C literally didn't know anything about
such things). Having a copy of the Disassembled Spectrum ROM (yeah, that
was a *real* book, written by Logan and O'Hara) handy was a must when
dealing with such things, after getting bored of implementing stacks
and binary trees ;-)
Dan