3 ms·
>[1] Notably, the char type, since the PDP-11 was byte addressable but the PDP-7 was not. "char" is a useful type for the program's problem domain regardless o
by brucehoult 5y ago
>[1] Notably, the char type, since the PDP-11 was byte addressable but the PDP-7 was not.
"char" is a useful type for the program's problem domain regardless of whether the machine is byte-addressed or not. Pascal was developed on machines that were not byte-addressable but always had a char type. This is easily visible in the PACK and UNPACK standard functions and the PACKED keyword for arrays and records. It is slow to do access to a random char from an array packed several to a word, so there are standard functions to copy everything from a packed array to an array that uses one word per item for easier processing, and back again.
If anything, you need the compiler to support the char type more if you don't have a byte-addressed machine because it's such a pain for the programmer to deal with themselves.
Standard Algol 60 didn't have "char" but some manufacturers added it non-standard. Algol 68 had char. These ran on primarily word-addressed machines too, as was the fashion in those days.
- gumby 5y agoYet all these languages were limited to the 8-bit byte. C on the PDP-10 and -20 only had an 8-bit byte while all other languages on those machines Al had native access to bytes of width 1-36 bits — yes, std::vector<bool> in hardware, but more powerful. Though a general purpose machine it had instructions specifically designed for low cost Lisp implementation, arbitrary numbers of stacks etc…all inaccessible to C
- brucehoult 5y agoThere is no requirement in C for char to be 8 bits. Even in modern C it's allowed to be bigger than that. For sure it is a bit limiting that in C everything else has to be a multiple (possibly x1) of the size of char. Other languages don't have that restriction. Algol68 allowed char to be as small as 6 bits, the size on the ICL 1900 it was first developed on (with a 24 bit word size). Pascal was first implemented on the CDC 6600, with 60 bit words and characters again 6 bits. The first other machine Pascal was ported to was, again, the ICL 1900.