Missing version(Unix). Again.

Anders F Björklund afb at algonet.se
Mon May 1 10:55:13 PDT 2006


Sean Kelly wrote:

> On Linux I set an environment variable like so:
> 
>     DFLAGS=-version=Posix
> 
> Not quite as good as compiler support perhaps, but it does the trick.

It does ?

I could add DFLAGS="-version=Unix" to my DMD invocation guidelines,
and make sure that I copy a version of std/c/unix/unix.d to every
new Phobos, but I will still have to edit all the source code that
uses "version(linux)" and "import std.c.linux.linux;" without need.

If I really wanted to, I could even use both in parallell, like the
workarounds we have used in the past to support both of GDC and DMD:

version(DigitalMars)
     version(linux)
         version = Unix;

version(DigitalMars)
     version(linux)
         import std.c.linux.linux;
version(GNU)
     version(Unix)
         import std.c.unix.unix;

But somehow it's both a ugly workaround, and not worth the effort...
It would be easier if one could use the same source code, for both ?

--anders


PS.
I'm not really sure why Ares changed the name from Unix to Posix,
surely there was a good reason for doing it differently from GDC ?
"Unix", see http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/1212
(hope it doesn't mean that we need *three* versions, in the above)



More information about the Digitalmars-d mailing list