From mboxrd@z Thu Jan 1 00:00:00 1970 From: jnc@mercury.lcs.mit.edu (Noel Chiappa) Date: Wed, 21 Mar 2018 21:40:03 -0400 (EDT) Subject: [TUHS] Comments in early Unix systems Message-ID: <20180322014003.2184E18C085@mercury.lcs.mit.edu> > From: Warren Toomey > there is next to no commenting in the early code bases. By 'early' you must mean the first 'C' PDP-11 Unixes, because certainly starting with V6, it is reasonably well commented (to the point where I like to say that I learned how to comment by reading the V6 code), e.g.: http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/sys/ken/slp.c http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/sys/dmr/bio.c to pick examples from each author; and there are _some_ comments in the assembler systems (both PDP-7 and PDP-11). > Given that the comments never made it into the compiled code, there was > no space reason to omit comments. There must have been another reason. I was going to say 'the early disks were really small', but that hypothesis fails because the very earliest versions (in assembler) do have some comments. Although assembler is often so cryptic, the habit of putting a comment on each instruction isn't so unreasonable. So maybe the sort of comments one sees in assembler code (line-by-line descriptions of what's happening; for subroutines, which arguments are in which registers; etc) aren't needed in C code, and it took a while for them to work out what sort of commenting _was_ appropriate/useful for C code? The sudden appearance in V6 does make it seem as if there was a deliberate decision to comment the code, and they went through it and added them in a deliberate campaign. > From: Andy Kosela > "Practice of Programming" by Rob Pike and Brian Kernighan. > ... > They also state: "Comments ... do not help by saying things the code > already plainly says ... The best comments aid ... by briefly pointing > out salient details or by providing a larger-scale view of the > proceedings." Exactly. Noel