Wednesday, September 19, 2007

Comment Switches

What are comment switches and how to use them? To comment and uncomment certain blocks of code repeatedly, I use what I call a "comment switch", allowing me to switch a block of code on or off with a single character. It looks like this:
//*
printf("I am active!\n");
// */
/*
printf("I am commented out!\n");
// */

Switch between two code blocks with a single character:
//*
printf ("I am active!\n");
/*/
printf ("I am commented out!\n");
// */
/*
printf("Now I am commented out!\n");
/*/
printf("And I am active!\n");
// */
Addendum:
I recently found a forum posting where a similar comment switch was proposed:
/*
comment
/* */

//*
uncomment
/* */

No comments:

Translate