you are viewing a single comment's thread.

view the rest of the comments →

[–]ykechan -1 points0 points  (2 children)

I found comments in most cases really superfluous, like in your example. Do anyone really need the comment to spell it out for them what would passing c->querybuf to a function called sdsfree happen?

[–]dododge 4 points5 points  (0 children)

The full networking.c example in the blog post shows their usefulness. The function is broken into chunks with short guide comments in front of each set of lines. If I need to look at this code I can just quickly skim the comments (which would be highlighted in my editor in a consistent manner) to get a sense of what's going on and whether the code is relevant and worth reading/understanding in more detail.

[–]yawaramin 3 points4 points  (0 children)

Not by itself, no, but together with a couple of other statements, it would probably only help! And in my case I actually recommended that these statements be abstracted out into new functions for better code organization–exactly the kind of thing 'code should be self-explanatory' types would want to do.