(Non) Nesting block comments

Robert Fraser fraserofthenight at gmail.com
Tue Jul 21 15:34:00 PDT 2009


Michel Fortin wrote:
> On 2009-07-21 05:31:13 -0400, Michiel Helvensteijn 
> <m.helvensteijn.remove at gmail.com> said:
> 
>> Robert Jacques wrote:
>>
>>> 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.
>>
>> Why? I believe that /++/ works exactly like /**/ in that regard. 
>> Doesn't it?
>>
>> //+
>> code that can be turned off by removing the first /
>> //+/
> 
> I'm pretty sure he meant comment out a signle line at the top, not both, 
> like this:
> 
>     /*
>     A
>     /*/
>     B
>     /**/
> 
> With this, you compile B while A is in a comment. Add "/" at the start 
> of the first line and you compile code A while B is now in commented out.

Wow, you just blew my mind. I wish they taught this sort of stuff in 
programming 101.



More information about the Digitalmars-d mailing list