teknomunk avatar

C/C++ Debugging Tip

teknomunk

Published: 24 Aug 2018 › Updated: 24 Aug 2018

C/C++ Debugging Tip

I'm not sure when I discovered this, or if I've ever seen this posted anywhere, but this is a simple trick with multi-line comments I use when debugging code:

//*
Uncommented code
/*/
Commented code
//*/

To change this around, just remove the first /:

/*
Commented code
/*/
Uncommented code
//*/

What is going on is /*/ will always toggle commented to uncommented and vice versa. //*/ always ends a multi-line comment without causing a syntax error if there wasn't a multi-line comment before it.

Leave C/C++ Debugging Tip to:

Written by

Read more #programming posts


Best Posts From teknomunk

We have not curated any of teknomunk's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From teknomunk