Posix vs. Windows

Sean Kelly sean at invisibleduck.org
Fri May 18 09:37:23 PDT 2012


On May 17, 2012, at 1:01 PM, Mehrdad wrote:

> From looking at Phobos, I'm understanding that the main difference between the implementation of various features for Posix systems as compared to Windows systems (aside from the API, etc.) is that Windows tends to do a lot of stuff *before* the program is loaded (and hence requires special cases in a lot of places), whereas Posix systems tend to require you to call initializers manually (and hence they're called just like any other function).
> 
> Just wanted to check, is this understanding correct?

I'd say that Windows tends to do more for you, while Posix provides lower-level APIs to accomplish the same thing.  So Posix offers more control and is typically more robust as a result.  There are a few exceptions however, like SEH has proven to be far more capable than signals for certain classes of error handling.


> (The reasoning being, if I'm writing my own little kernel, I want to figure out whether I should be compiling Phobos with Posix or with Windows, to minimize my headaches... although I should mention that, either way, I'm going to be developing on Windows, in PE format.)

If you're targeting Windows then use Windows APIs, if Posix then Posix.  Windows does claim Posix support, but it's really pretty terrible and Druntime doesn't have declarations for the Posix Windows interface anyway.


More information about the Digitalmars-d mailing list