Chapter 5: A Passing Comment
Mull It Over
How might the need for and the content of comments differ in the following types of code:
Low-level assembly language (machine code)
Shell scripts
A single-file test harness
A large C/C++ project
Assembly language is less expressive, providing fewer opportunities for self-documenting code. Therefore, you’d expect more comments in assembly code, and you’d expect those comments to be at a much lower level than comments in other languages—assembly language comments generally would explain how as well as why.
There isn’t an enormous a difference between the remaining three. Shell scripts can be quite hard to read back; they are proto-Perl in this respect. Careful commenting helps. You’re more likely to use literate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access