static version proposal

Daniel Murphy yebblies at nospamgmail.com
Fri Sep 23 06:59:57 PDT 2011


"Gor F. Gyolchanyan" <gor.f.gyolchanyan at gmail.com> wrote in message 
news:j5i2kv$2abh$1 at digitalmars.com...
> Not exactly.
> You'll also need to include code, which checks if the symbol API_VER is 
> defined
> before checking it's value. This will make the code bloated. One way to do 
> it is
> to define a template which takes the symbol in the form of a string, but 
> that
> would look very ugly.

Why would you do that?  You'll get an error if it's undefined, just like you 
would with #if in c/c++.
If you wanted to use existance of a symbol instead of an enum's value, 
static if(is(typeof())) should do the job.
Essentially, static if can already do what you're asking for, and is much 
more flexible. 




More information about the Digitalmars-d mailing list