(Non) Nesting block comments

Marianne Gagnon auria.mg at gmail.com
Mon Jul 20 18:31:40 PDT 2009


In C++, I use comments for 2 purposes :

1) Add documentation
2) Disable code (also with #if 0 ... #endif)

Since those two actions are logically very different, I believe it's nice that they're separate.

Why I *would* propose, however, is to get rid of /**  ... */, and say that /* ... */ is always for documentation.

> D has the old C style block comments that start with /* and end with the
> first possible */. But it also has nesting block comments, starting with /+
> and ending with the *matching* +/.
> 
> The nesting block comments were a great idea, since they can be used
> to 'comment out' any block of code, even if other block comments are
> already present.
> 
> I was wondering, though. C++ compatibility aside, is there an actual use
> case for the C style block comments anymore? Has anyone here written some
> code lately where they thought: "I really need a comment here containing /+
> or +/ without the matching delimiter! Thank <deity> for C style comments!"
> 
> (Yes, this is bikeshed stuff, and I don't really care. I like programming
> language syntax discussions. Sometimes they are low barrier discussions.)
> 
> -- 
> Michiel Helvensteijn
> 




More information about the Digitalmars-d mailing list