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.

-Steve

Reply via email to