Hacker News new | ask | show | jobs
by feisuzhu 2038 days ago
Comment toggle:

    foo();
    //*
    some();
    code();
    which_you_want_to_comment_out();
    // */
    other_code();
Code between comments are 'enabled' for now, and can be commented out by simply removing a slash in the '//*'.
2 comments

It is very common to use #if 0 ... #endif for this.
Even better, #ifdef NOTYET or similar, to help future readers (which may include "you, tomorrow") understand why it's not happening.
First example I’ve seen in this entire post that I really like.

A lot of the rest of these look like they’re just trying to be clever for the sake of it.

There's also:

  /** /
  do_thing();
  /*/
  do_other();
  //*/
which allows quickly toggling between `thing` and `other` while debugging.