Reply to post:

Linus Torvalds in sweary rant about punctuation in kernel comments

bombastic bob Silver badge

"If 'blah blah' happens to be a block of code you commented out, you want a fast method to uncomment: just remove 2 lines."

how about this:

#if 0

commented = out * code;

fprintf(stderr, "line %d in %s\n", __LINE__, __FUNCTION__);

#endif // 0

works nice for test or debug code.

Using the '#if 0' block makes it so that if your code contains /* */ comments, you can STILL 'comment it out' with only 2 lines, but then you only need to change the '0' to a '1' to re-enable it afterwards...

or you could get really good at 'tapping out' the keystrokes for putting // at the beginning of a bunch of consecutive lines of code (being a drummer helps), using a rapidly repeated sequence of '//' left, left, down with left hand on '/', right hand on cursor keys [or else use a keystroke recorder to make a macro of it, playable with a hotkey]

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019