Why version() ?

Tim M a at b.com
Tue Feb 10 04:09:10 PST 2009


On Wed, 11 Feb 2009 00:28:21 +1300, bobef <bobef at nospam-abv.bg> wrote:

> I was thinking... what is the point of version() ? It is so inflexible.  
> There is no even version(!...). Why not "static if(version(DMD))" or  
> static if(is(version == DMD))?
>
> Regards,
> bobef

You could try something like this:


module Vers;

template vers(char[] V)
{
       mixin("version(" ~ V ~ ")
       {
             const bool vers = true;
       }
       else
       {
             const bool vers = false;
       }");
}

int main()
{
       static if(vers!("X86_64"))
       {
             long a;
             pragma(msg, "64 bit");
       }
       else
       {
             int a;
             pragma(msg, "32 bit");
       }

       a = 2;

       return a;
}




More information about the Digitalmars-d mailing list