FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"Posix" vs "Unix"

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Wed May 04, 2005 5:00 am    Post subject: "Posix" vs "Unix" Reply with quote

Background:
Mango uses version(Posix), while GDC uses version(Unix).
(and DMD just uses "linux" and ignorance, as it always has)

Just wondered if anyone had anyone opinions on the names ?
Maybe this could even be merged in a future D (DMD) version ?

Mango: (dmd -version=Posix is added by the Makefile)
Code:

version (Posix)
{
    version(linux)
    {
        private import std.c.linux.linux;
        alias std.c.linux.linux posix;
    }
    else version(darwin)
    {
        private import std.c.darwin.darwin;
        alias std.c.darwin.darwin posix;
    }
    else static assert(0);
}

...

version (Win32) { // do Win32 stuff }
version (Posix) { // do Posix stuff }


GDC: (version Unix is set by the compiler)
Code:

version (linux) {
    version = Unix; // for DMD
}

version (Unix)
{
    version (GNU) {
   private import std.c.unix;
   alias std.c.unix unix;
    } else version (linux) {
   private import std.c.linux.linux;
   alias std.c.linux.linux unix;
    }
}

...

version (Windows) { // do Windows stuff }
version (Unix) { // do Unix stuff }


std.c.darwin.darwin has been "deprecated" in GDC 0.11.
(well, not really, but std.c.unix is the correct one to use)

Switching over to Unix would make it easier to port, but I
was just wondering which "name" that's really the best ?
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed May 04, 2005 12:44 pm    Post subject: Reply with quote

Both :p I'd like it if we could just use 'Posix' but the Unix standard defines other stuff that people may want to use that is outside the POSIX umbrella: unistd, for instance. But as it's always preferable to restrict based on API rather than OS, I think use of the 'Posix' flag would be far more common. This may get somewhat nasty where high-performance stuff is concerned, as each OS tends to have its own nonstandard method for doing these things--socket comms being a prime example. So we'll likely also be stuck with flags for 'Aix', 'Bsd', 'Solaris', etc, that are used judiciously.
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Wed May 04, 2005 1:41 pm    Post subject: Reply with quote

sean wrote:
Both :p I'd like it if we could just use 'Posix' but the Unix standard defines other stuff that people may want to use that is outside the POSIX umbrella: unistd, for instance. But as it's always preferable to restrict based on API rather than OS, I think use of the 'Posix' flag would be far more common. This may get somewhat nasty where high-performance stuff is concerned, as each OS tends to have its own nonstandard method for doing these things--socket comms being a prime example. So we'll likely also be stuck with flags for 'Aix', 'Bsd', 'Solaris', etc, that are used judiciously.


That's true. But at least with Posix we know we have an interface that is common across all unixes. OS specific calls will always be a reality; those API's should at least be independent.

-JJR
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group