Jump to page: 1 2
Thread overview
nested comments
May 30, 2011
%u
May 30, 2011
Adam D. Ruppe
May 30, 2011
Jonathan M Davis
May 30, 2011
%u
May 30, 2011
Timon Gehr
May 30, 2011
%u
May 31, 2011
Jesse Phillips
May 31, 2011
bearophile
May 31, 2011
Nick Sabalausky
May 31, 2011
Ary Manzana
May 31, 2011
Jonathan M Davis
May 31, 2011
Nick Sabalausky
May 31, 2011
Jonathan M Davis
May 31, 2011
Jonathan M Davis
May 31, 2011
bearophile
Jun 01, 2011
Nick Sabalausky
Jun 01, 2011
Jonathan M Davis
May 30, 2011
what is the purpose of nested comments ?
May 30, 2011
I use them when commenting out code or when writing documentation examples. (which may have comments nested inside the doc comment)

Commenting out code is the purpose in general though.
May 30, 2011
On 2011-05-30 14:21, Adam D. Ruppe wrote:
> I use them when commenting out code or when writing documentation examples. (which may have comments nested inside the doc comment)
> 
> Commenting out code is the purpose in general though.

Yeah, it's really annoying to comment out code with /* */ when it already contains comments which used /* */. /+ +/ doesn't have that problem thanks to the nesting, and it's fantastic. /++ +/ can be used for ddoc comments, but beyond that, I don't generally use /+ +/ for actual comments. It's real usefulness is in commenting out code.

- Jonathan M Davis
May 30, 2011
commenting out code?? example please
May 30, 2011
> commenting out code?? example please

/+
/* this is code: */
int more_code; // more code
code(more_code+even_more_code(1321));
+/
May 30, 2011
I understand it
thanks
May 31, 2011
%u Wrote:

> what is the purpose of nested comments ?

The purpose is commenting out code, but note that there is also version(none) { } which is never compiled in.
May 31, 2011
Jesse Phillips:

> The purpose is commenting out code, but note that there is also version(none) { } which is never compiled in.

version(none) {} is probably the official way to comment out code.
And if you use a versioning system to keep your code, then commenting out code is not a so wise thing to do.

Bye,
bearophile
May 31, 2011
"bearophile" <bearophileHUGS@lycos.com> wrote in message news:is1dj6$ihb$1@digitalmars.com...
> Jesse Phillips:
>
>> The purpose is commenting out code, but note that there is also version(none) { } which is never compiled in.
>
> version(none) {} is probably the official way to comment out code.
> And if you use a versioning system to keep your code, then commenting out
> code is not a so wise thing to do.
>

Why not? I've never heard of a VCS that went around stripping out all comments.


May 31, 2011
On 2011-05-30 17:43, bearophile wrote:
> Jesse Phillips:
> > The purpose is commenting out code, but note that there is also version(none) { } which is never compiled in.
> 
> version(none) {} is probably the official way to comment out code.
> And if you use a versioning system to keep your code, then commenting out
> code is not a so wise thing to do.

There's absolutely nothing wrong with commenting out code. I do it all the time when working on code. It's extremely useful to do so. /+ +/ is _extremely_ useful, and there's absolutely nothing wrong with using it. What _is_ a bad idea is leaving in sections of commented out code when you check in code.

- Jonathan M Davis
« First   ‹ Prev
1 2