3 ms·
This article completely omits mention of 'why' comments, and only talks about 'what' comments. I can just about accept that in a sufficiently descriptive langu
by rkangel 10y ago
This article completely omits mention of 'why' comments, and only talks about 'what' comments.
I can just about accept that in a sufficiently descriptive language that what the code is doing can possibly be made clear (in practice for things like embedded C, this isn't actually true). But no code, however well named, can ever tell you WHY it is doing what it is doing. Those code comments are invaluable.
They can range from the trivial explanation of a corner case bug as the rationale for an otherwise pointless looking bit of error checking, to discussing a system requirement when explaining the implementation choice for a whole module.