[TUHS] C comments

Doug McIlroy doug at cs.dartmouth.edu
Sat Dec 8 13:54:17 AEST 2018


Very little in language design is so contentious as comment conventions.

C borrowed the PL/I convention, which had the virtue of being useful
for both in-line and interlinear comments, and did not necessitate
marking every line of a long comment. Nobody in the Unix lab had
had much experience with the convention, despite having worked on
Multics for which PL/I was the implementation language.

And how did PL/I get the convention?  It was proposed by Paul
Rogoway at the first NPL (as it was then called) design-committee
meeting that I attended. Apparently the topic had been debated
for some while before and people were tired of the subject. Paul
was more firmly committed to his new idea than others were to
old options, so it carried more or less by default. Besides, there
was a much more interesting topic on the agenda. Between the
previous meeting and that one, George Radin had revamped the
entire NPL proposal from mainly Fortran-like syntax to Algol-like.
That was heady enough stuff to divert people's attention from
comments.

As for inexperiece. The comment conventions of previous
languages had not fostered the practice of commenting out
code. So that idea, which is the main impetus for nesting
comments, was not in anybody's mind at the time. Had it
been, nesting might well have carried the day. It probably could
have been changed before 1980, but thereafter there were
too many C compilers. Then standards introduced even more
conservatism. Perhaps Ken can remember whether the notion
was ever seriously considered.

Doug



More information about the TUHS mailing list