Pascal not considered harmful - was Re: Rich kids are into COBOL
imp at bsdimp.com
Sat Feb 21 08:11:50 CST 2015
> On Feb 20, 2015, at 9:47 PM, Eric Smith <spacewar at gmail.com> wrote:
> One can argue that a not-quite-C compiler for a PDP-10 that supported
> 6-, 7-, and 8-bit character types as well as 18-bit and 36-bit
> integers would be useful, but by definition it wouldn't actually be C.
The one C compiler that was written at my University for the Tops-20
allowed you to select 6, 7, 8 or 9-bit chars. This was written in 1984-88
or so, and was a pure K&R compiler with prototypes added. This was,
at the time, standards conforming because K&R didn’t require any of
that fancy ANSI-C stuff (which was still years away).
There were a number of tricks used to make the math work out right,
since the architecture was word addressed. IIRC, it relied on char *
pointers being “special”. All pointers were 36-bit in size, with some
of the upper bits being used to address sub-word quantities for
character operations. The character size was, iirc, fixed for all
The compiler was a wizard at figuring out all the nuances. But since
only 22 of the 36 bits could ever be used for an address, the extra
bits in pointers were otherwise ‘wasted’. It make conversion between
int and pointers and doing math on them somewhat undefined or
at least somewhat different than one would otherwise expect.
Sadly, at the time a metric truckload of code expected pointers and
ints to be freely convertible, and all pointers to be byte addressable
with a linear space.
It was ‘C’ enough that most things ran well enough. Many constructs
that you wouldn’t think would work in this mixed up, jumbled up world
actually did work. Also, IIRC, there was no such thing as a void *
in this compiler (and if there was it would be identical to a char *).
But it did mean that something like:
char *cp = ch + 5;
(char *)(int *)cp; /* Might not equal cp any more */
gcc has (had?) a pdp10 mode to support the toad-1, but I never used
that. And I stopped using Greg Titus’ C compiler back in ’89 when I left
school. It was sold to some outfit out of Santa Fe and Greg moved there
about the same time I left school to support it. Not sure what ever
happened to him after that. He also taught my intro to C class, so I
learned all manner of “safe” C perversion from him….
More information about the cctalk