News for hackers. Stuff that matters.
Re:Ask HN: If Unix is written in C, how did they run C befor... by ksherlock on Tuesday April 04, 2023 @12:21PM (#35442072)
V1: (PDP-7 Unix) Kernel is written in assembly. C does not exist yet.

V2: (PDP-11 Unix) Kernel is written in assembly. C compiler is written in assembly.

V3: Kernel is written in assembly. C compiler is written in C.

V4: Kernel is written in C. C compiler is written in C.

https://www.tuhs.org/cgi-bin/utree.pl?file=PDP7-Unix

https://www.tuhs.org/cgi-bin/utree.pl?file=V2

https://www.tuhs.org/cgi-bin/utree.pl?file=V3

https://www.tuhs.org/cgi-bin/utree.pl?file=V4

Re:Ask HN: If Unix is written in C, how did they run C befor... by ipnon on Tuesday April 04, 2023 @12:46PM (#35442463)
Part of the reason for registers carrying powers of 2 bits is the runaway popularity of C and Unix. The PDP-11 had 16-bit registers. Some of the programming conventions we still use today originated with a humble PDP-11 at Bell Labs.
Re:Ask HN: If Unix is written in C, how did they run C befor... by kens on Tuesday April 04, 2023 @01:31PM (#35443132)
I would put most of the popularity for word lengths that are powers of 2 on the IBM System/360 (1964), rather than the PDP-11 (1970). The enormous popularity of the System/360 is what made computers standardize on bytes, along with words that were multiples of bytes. Prior to that, word sizes were all over the map: 6, 12, 36, as well as really random values such as 23, 27, 29, or 35 bit words.

This isn't to deny the popularity of the PDP-11, of course, but its use of 16-bit words was more of a consequence of the System/360. DEC's use of 12-bit words goes back to the LINC (1962) but by 1970, bytes were obviously the way to go.

Re:Ask HN: If Unix is written in C, how did they run C befor... by jnwatson on Tuesday April 04, 2023 @01:31PM (#35443125)
What does C have to do with power of 2-bit registers? CHAR_BIT isn’t restricted and could be 7.
Re:Ask HN: If Unix is written in C, how did they run C befor... by krylon on Tuesday April 04, 2023 @01:56PM (#35443532)
Doesn't the standard state CHAR_BIT has to be >=8? If could still be, say, 11 of course.
Re:Ask HN: If Unix is written in C, how did they run C befor... by tharkun__ on Tuesday April 04, 2023 @12:54PM (#35442583)
And to extend that a bit for the OP also read: https://en.wikipedia.org/wiki/Computer_programming_in_the_pu... and https://en.wikipedia.org/wiki/Punched_tape and similar literature for the "interface" with a computer. No "terminal" required :)
Re:Ask HN: If Unix is written in C, how did they run C befor... by bradwood on Tuesday April 04, 2023 @01:34PM (#35443181)
And then later versions of the C compiler were written in earlier version of the C compiler...
Re:Ask HN: If Unix is written in C, how did they run C befor... by czx4f4bd on Tuesday April 04, 2023 @01:39PM (#35443267)
On top of that, C came about specifically because Ken Thompson and Dennis Ritchie wanted a better language for implementing Unix utilities and, later, Unix itself. https://en.wikipedia.org/wiki/C_(programming_language)#Histo...