(Non) Nesting block comments

Robert Fraser fraserofthenight at gmail.com
Mon Jul 20 15:25:52 PDT 2009


Michiel Helvensteijn wrote:
> 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.)
> 

/* is good when commenting out code moving upwards. You put one */ at 
the bottom and add /*s to comment out more and more code until it 
works... Okay, that's a really bad use case, I might've done it twice in 
my life.



More information about the Digitalmars-d mailing list