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:

Productivity and Note-taking

I told a friend of mine that I wasn't really happy with the amount of time that gets taken up by Slack and "communication and sched...