4 ms·
There are times when you absolutely want to comment something like an "Add" or "Swap" function. eg. // The reason we use a custom swap function instead of //
by ilitirit 12y ago
There are times when you absolutely want to comment something like an "Add" or "Swap" function.
eg.
// The reason we use a custom swap function instead of
// the one that is shipped with the framework is because
// of an edge-case that occurs quite frequently in our
// scenario
// Refer to Change Request 345.
void Swap (Foo a, Foo b)
....
- ricardolopes 12y agoI think you are missing the point there. Sure, I completely agree with you that those comments are crucial, but they are not informing about the code doing a swap, they are explaining the need of the applied workaround.
- notduncansmith 12y agoThat's precisely the point. In most cases, what your code is doing should be obvious; the why, as others have stated, would be otherwise completely out-of-band information, which explains the necessity for comments.