nested comments

Jose Armando Garcia jsancio at gmail.com
Tue May 31 10:16:49 PDT 2011


On Mon, May 30, 2011 at 11:58 PM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On 2011-05-30 19:53, Nick Sabalausky wrote:
>> "Ary Manzana" <ary at esperanto.org.ar> wrote in message
>> news:is1hsa$p53$1 at digitalmars.com...
>>
>> > On 5/31/11 7:58 AM, Nick Sabalausky wrote:
>> >> "bearophile"<bearophileHUGS at lycos.com>  wrote in message
>> >> news:is1dj6$ihb$1 at 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.
>> >
>> > The question is: why comment and commit code that you can already find in
>> > the commit history? Then you end up with huge files with things like:
>> >
>> > /*
>> >
>> >  * Maybe we will use this in a future, this is not working right now
>> >  ...
>> >  ...
>> >  ...
>> >  */
>> >
>> > and the code becomes a mess.
>> >
>> > So I agree with bearophile here.
>>
>> But that applies to version(none) {}, too. Maybe I misunderstood
>> bearophile, I thought he meant "if you use a versioning system to keep
>> your code, then commenting out code [as opposed to using version(none) {}]
>> is not a so wise thing to do"
>
> I'm not sure what he meant. Personally, I don't see much value to
> version(none). I believe that the only gain that you get out of it is that the
> code must be syntactically correct. And since the code is never going to be
> used until you change the version, I don't really see much value in that.
> Comments do the job just as well.
>
> - Jonathan M Davis
>

Use static if(false) the compiler makes sure that code still compiles
at least. The problem with commented out code being saved in common
code repositories is that it can suffer from bit rust.


More information about the Digitalmars-d-learn mailing list