Thread overview | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 30, 2011 nested comments | ||||
---|---|---|---|---|
| ||||
what is the purpose of nested comments ? |
May 30, 2011 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | 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 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | commenting out code?? example please |
May 30, 2011 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | > commenting out code?? example please /+ /* this is code: */ int more_code; // more code code(more_code+even_more_code(1321)); +/ |
May 30, 2011 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | I understand it thanks |
May 31, 2011 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | %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 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | 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 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | "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 Re: nested comments | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | 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
|
Copyright © 1999-2021 by the D Language Foundation