Version statement

Walter Bright newshound2 at digitalmars.com
Tue Dec 14 11:16:47 PST 2010


Extrawurst 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;}

The idea is that versions should be positive statements, not some complex 
formulation from other versions. The latter is commonplace in C, and in my 
experience nearly always wrong.

For example, NotWin32 is, what? It's a bug waiting to happen. The preferred way is:

version (Win32)
     ...
else version (linux)
     ...
else
     static assert(0, "unsupported system");



> 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.

I don't know what that means.


More information about the Digitalmars-d mailing list