On 24/10/2012 10:40, Don Clugston wrote:
On 23/10/12 05:17, 1100110 wrote:
Looking at std.io (hopefully the right version maybe?) I see this:
version(OSX)
{ do something; }
version(Windows)
{ do the same thing as above; }
version(FreeBSD)
{ ditto; }
version(Linux)
{ finally do something different; }
and:
version(Windows) version(DigitalMars)
{ something; }
I was rather surprised that this wasn't accepted:
//Error: found '||' when expecting ')'
version(OSX || Windows || FreeBSD)
{ do something; }
version(Linux)
{ do something different; }
The last one could be intuitively described as:
version(Windows && DigitalMars)
{ blah; }
That allows you to create the same bird's nest that you can get with
#ifdef in C.
See bug 7417 for a different solution that fixes other problems as well.
Just make version declarations behave like bool variable declarations:
version useTheOrdinaryWay = OSX || Windows || FreeBSD;
version dmdWindows = Windows && DigitalMars;
version (dmdWindows) { blah; }
Vote up!
http://d.puremagic.com/issues/show_bug.cgi?id=7417