zfunction()
{
/*thing
thing
thing
if(ypasdafsdf)
{ thing
/*thing
thing*/
}
thing
thing
thing*/
}
Super comment
Sometimes in a block of C++ code, I have the /* */ and sometimes I want to comment all of the code so if I put another /* */, it becomes a headache.
example
Is there a solution to this?
Or use // comments. In a good IDE or editor, you should be able to select the text you want to comment, and then press some key combination to //-ify it.
Personally, I never understood why they made /* */ not nestable. I can understand that in the 70's in the C programming language they might have done it to make the parser of the code a bit more efficient. But I don't understand that other curly brace language, like Java, followed this and still don't allow nesting /* */ comments...
Personally, I never understood why they made /* */ not nestable. I can understand that in the 70's in the C programming language they might have done it to make the parser of the code a bit more efficient. But I don't understand that other curly brace language, like Java, followed this and still don't allow nesting /* */ comments...
zfunction(){/*thingthingthingif(ypasdafsdf){ thing /*thing thing*//*}thingthingthing*/}
Closest I could get to a solution. I personally only use /**/ for header comments and use // to comment out code (it can be a PITA to do manually, but it's better than dealing with nested /**/ comments).
I hate GD.net's forum software, could someone tell my how to post code in code tags? I tried but the above is what happens.
Quote:Original post by Lode
Or use // comments. In a good IDE or editor, you should be able to select the text you want to comment, and then press some key combination to //-ify it.
Personally, I never understood why they made /* */ not nestable. I can understand that in the 70's in the C programming language they might have done it to make the parser of the code a bit more efficient. But I don't understand that other curly brace language, like Java, followed this and still don't allow nesting /* */ comments...
It can't be represented with a regular expression that way, so the lexical analyzer becomes more complicated. C# allows nesting I believe, but in a language that operates on design-by-committee, it's really hard to get anything changed.
To the OP, if you're using Visual Studio, highlight everything and hit Ctrl+K C
Some C compilers allow comment nesting, although that was non-standard behaviour. I doubt any major compiler still does it, at least by default.
But yeah, if you want to disable code that contains that kind of comments, use #ifdef 0 ... #endif. It also has the additional advantage that it can be nested!
But yeah, if you want to disable code that contains that kind of comments, use #ifdef 0 ... #endif. It also has the additional advantage that it can be nested!
Quote:Original post by cache_hitQuote:Original post by Lode
Or use // comments. In a good IDE or editor, you should be able to select the text you want to comment, and then press some key combination to //-ify it.
Personally, I never understood why they made /* */ not nestable. I can understand that in the 70's in the C programming language they might have done it to make the parser of the code a bit more efficient. But I don't understand that other curly brace language, like Java, followed this and still don't allow nesting /* */ comments...
It can't be represented with a regular expression that way, so the lexical analyzer becomes more complicated. C# allows nesting I believe, but in a language that operates on design-by-committee, it's really hard to get anything changed.
To the OP, if you're using Visual Studio, highlight everything and hit Ctrl+K C
#if 0 is good but your Ctrl+K C is nice as well. It works in VC++ 2008 Express.
May I ask how did you learn about the Ctrl+K C?
Is it in the menu?
Quote:Original post by Firestryke31
I hate GD.net's forum software, could someone tell my how to post code in code tags? I tried but the above is what happens.
Take a look at this sticky thread which has some useful information on source tags.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement