3 ms·
If that's the only issue, you can do: /*/ Version one, currently commented /*/ Version two, currently active /**/ And a single star switches from vers
by Robin_Message 13y ago
If that's the only issue, you can do:
/*/ Version one, currently commented
/*/ Version two, currently active /**/
And a single star switches from version two to version one.
But I agree this shouldn't be left in production code; it's just a handy trick for switching between two blocks of code†. An #ifdef is also good, but that's C/C++ only.
† Whoever suggested that some editors can comment a block of code missed the point utterly - which is to switch between code blocks easily.
- aprescott 13y agoThe trouble with this is that you now have to switch "commented" to "active" and vice versa, when I think the aim was to have a single-char switch (although the syntax is pretty horrible, to be honest).
- Evbn 13y agoYou would just leave out the comment text.
- Robin_Message 13y agoThat one also has a single character switch – just add another star on the first line. It avoids the nested comment issue of the version posted.
- Evbn 13y agoEvery text editor can uncomment a block of code with a macro. Why on Earth would the number of chracters matter? And every language has the IF construct. And of you are flipping between two implementation so frequently, your actual problem is that you have no idea how your program works.