Version statement

Denis Koroskin 2korden at gmail.com
Tue Dec 14 13:10:41 PST 2010


On Tue, 14 Dec 2010 21:46:47 +0300, Extrawurst <spam at extrawurst.org> wrote:

> Hi i just want to discuss two points about D version statements.
>
> 1) Why is it not possible to negate the condition of a version  
> statement. I think it is unintuitive and keeps me writing weird  
> statements like:
> version(Win32){}else{version = NotWin32;}
>
> 2) I would really like the idea to be able to get a compiletime string  
> of version identifiers in some kind of way. Perhaps even an array of  
> version-strings.
>
> Any thoughts on that ?
>
> Regards,
> Stephan

Try using static if instead:

version (Win32) {
     enum IsWin32 = true;
} else {
     enum IsWin32 = false;
}

static if (IsWin32) {
     // ...
}


static if (!IsWin32) {
     // ...
}


More information about the Digitalmars-d mailing list