"Steven Schveighoffer" <schvei...@yahoo.com> wrote in message news:op.vwcxmwfgeav7ka@localhost.localdomain... > On Mon, 30 May 2011 20:43:18 -0400, bearophile <bearophileh...@lycos.com> > 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. > > I would add that there is a huge difference between version(none) and > commenting -- version(none) code must still parse, whereas commenting out > code is more flexible. > > For example: > > for(int i = 0; i < 100; i++) > if(x == i) > { > writeln("found x") > if(y == i) > writeln("x and y are the same!"); > } > > > if you want to just comment out the if(x == i) line, using version(none) > is not going to work well. > > I would say that commenting out to test things is acceptable, but > version(none) should be used when code is to be turned off long-term. >
I prefer comments even for longer term. That way, it always gets highlighted as "THIS CODE IS NOT ACTIVE" and doesn't end up confusing me.