Click here to Skip to main content
Click here to Skip to main content

Super-Easy Code Block Toggling

, 30 Aug 2011 CPOL
This nice trick extends into://*/block 1/*/block 2; // commented out/*/block 3;/*/block 4; // commented out//*/and removing the first slash gives inverted alternation:/*/block 1; // commented out/*/block 2;/*/block 3; // commented out/*/block...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

22 Aug 2011
TheyCallMeMrJames
2 alternatives  
If you have two blocks of code that you are testing and need to switch back-and-forth between them, here's a commenting trick that works as a powerful code block toggling mechanism.Say you have a variable called foo of type string and want to change between using initialized values and...
15 Nov 2011
Caner Korkmaz
For debug use, you can do something like this:#ifdef DEBUG #define dprintf(...) printf(__VA_ARGS__)#else #define dprintf(...)#endif//Usage:dprintf("In debug mode.");//orchar *foo = "foo";dprintf("%d bar.",foo);// :)/*Edit reason :: *if you type...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ILa @ work
Engineer
Netherlands Netherlands
No Biography provided

| | Privacy | Terms of Use | Mobile
Web04 | 2.8.141220.1 | Last Updated 30 Aug 2011
Article Copyright 2011 by ILa @ work
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid