(Non) Nesting block comments

Robert Jacques sandford at jhu.edu
Mon Jul 20 20:51:42 PDT 2009


On Mon, 20 Jul 2009 16:53:11 -0400, Michiel Helvensteijn  
<m.helvensteijn.remove at gmail.com> 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.)
>

Well /* */ are excellent for toggling code sections. I tend to use  
constructs such as // */ or  //* or /*/ which allows me to turn on of off  
blocks with often a single key stroke. Using /+ +/ means I have to Add  
/++/ and remove /++/ each time I want to activate or deactivate a code  
block.



More information about the Digitalmars-d mailing list