Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualcr88192

Posted 17 May 2013 - 11:35 AM

granted, there is always #if 0 ... #endif, but still...

 

I like #if 0. I have my editor setup to identify such "frozen code" blocks and highlight them in a different color (generally light gray or light blue, different from comments). I find it handy to temporarily remove large blocks of code for debugging or prototyping. I never leave this stuff after, though, it just looks ugly and confusing.

 

Sure, it could probably be argued that it's not using the preprocessor for its intended usage, but what the hell, it's an idiom now so who cares wink.png

 

I wouldn't mind a clean nested comment feature for C++, though. It should probably nest by default, anyway. What was the reason for not allowing /* /* */ */? Harder/impossible to parse or something? I doubt it so there must be some other explanation.

 

I am not sure why people made the comments not nest.

 

in my language they do nest.

 

 

however, this can't be as-easily added to existing languages mostly as there is a risk of it breaking existing code (which may depend on the non-nesting behavior of these comments).

 

(decided to leave out a rant about the tendency of people to retain problematic edge-case behaviors in new languages with C-like syntax... even though a new language doesn't necessarily have piles of legacy code to maintain, and the new language will probably break stuff in other areas anyways, so some obscure edge-case behaviors are probably better off fixed as they are probably more often stumbled on by accident than by intention...).


#1cr88192

Posted 17 May 2013 - 09:09 AM

granted, there is always #if 0 ... #endif, but still...

 

I like #if 0. I have my editor setup to identify such "frozen code" blocks and highlight them in a different color (generally light gray or light blue, different from comments). I find it handy to temporarily remove large blocks of code for debugging or prototyping. I never leave this stuff after, though, it just looks ugly and confusing.

 

Sure, it could probably be argued that it's not using the preprocessor for its intended usage, but what the hell, it's an idiom now so who cares wink.png

 

I wouldn't mind a clean nested comment feature for C++, though. It should probably nest by default, anyway. What was the reason for not allowing /* /* */ */? Harder/impossible to parse or something? I doubt it so there must be some other explanation.

 

I am not sure why the comments don't nest.

 

in my language they do nest.

 

 

however, this can't be as-easily added to existing languages mostly as there is a risk of it breaking existing code (which may depend on the non-nesting behavior of these comments).

 

(decided to leave out a rant about the tendency of people to retain problematic edge-case behaviors in new languages with C-like syntax... even though a new language doesn't necessarily have piles of legacy code to maintain, and the new language will probably break stuff in other areas anyways, so some obscure edge-case behaviors are probably better off fixed as they are probably more often stumbled on by accident than by intention...).


PARTNERS