[TUHS] v7 K&R C

Paul Winalski paul.winalski at gmail.com
Mon May 18 02:24:13 AEST 2020


On 5/16/20, Steffen Nurpmeso <steffen at sdaoden.eu> wrote:
>
> Why was there no byte or "mem" type?

These days machine architecture has settled on the 8-bit byte as the
unit for addressing, but it wasn't always the case.  The PDP-10
addressed memory in 36-bit units.  The character manipulating
instructions could deal with a variety of different byte lengths:  you
could store six 6-bit BCD characters per machine word, or five ASCII
7-bit characters (with a bit left over), or four 8-bit characters
(ASCII plus parity, with four bits left over), or four 9-bit
characters.

Regarding a "mem" type, take a look at BLISS.  The only data type that
language has is the machine word.

>   +getfield(buf)
>   +char buf[];
>   +{
>   +       int j;
>   +       char c;
>   +
>   +       j = 0;
>   +       while((c = buf[j] = getc(iobuf)) >= 0)
>   +       if(c==':' || c=='\n') {
>   +               buf[j] =0;
>   +               return(1);
>   +       } else
>   +               j++;
>   +       return(0);
>   +}
>
> so here the EOF was different and char was signed 7-bit it seems.

That makes perfect sense if you're dealing with ASCII, which is a
7-bit character set.

-Paul W.


More information about the TUHS mailing list