OpenBSD port of dmd?

Daniel Murphy yebblies at nospamgmail.com
Fri Mar 16 17:45:26 PDT 2012


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:jk0l57$20hs$1 at digitalmars.com...
>
> Not convinced. They call it specialization, and it's a powerful concept. 
> We use it in std.algorithm all over the place.
>
> Andrei

You can do that just as well without using an 'else' block.

version(ThisOS)
{
   doItThisWay();
}
else version(ThatOS)
{
   doItThatWay();
}
else version(SomeOS)
{
   doItSlowWay();
}
else version(OtherOS)
{
   doItSlowWay();
}
else
   static assert(0, "OS not implemented");

This means you're forced to choose which way when implementing that new 
version, instead of hoping that it will work.

This is not really the same thing as (eg) specializing searching for narrow 
strings. 




More information about the Digitalmars-d mailing list