Jump to page: 1 25  
Page
Thread overview
Posix vs. Windows
May 17, 2012
Mehrdad
May 18, 2012
Sean Kelly
May 18, 2012
Mehrdad
May 18, 2012
Sean Kelly
May 18, 2012
H. S. Teoh
May 18, 2012
Mehrdad
May 18, 2012
Paulo Pinto
May 18, 2012
Paulo Pinto
May 18, 2012
Adam Wilson
May 18, 2012
Paulo Pinto
May 18, 2012
Sean Kelly
May 18, 2012
Paulo Pinto
May 18, 2012
H. S. Teoh
May 18, 2012
Simon
May 18, 2012
Mehrdad
May 18, 2012
Mehrdad
May 18, 2012
H. S. Teoh
May 18, 2012
Mehrdad
May 18, 2012
H. S. Teoh
May 19, 2012
Mehrdad
May 19, 2012
Mehrdad
May 19, 2012
H. S. Teoh
May 19, 2012
Mehrdad
May 19, 2012
Mehrdad
May 19, 2012
Paulo Pinto
May 19, 2012
Sean Kelly
May 19, 2012
Paulo Pinto
May 19, 2012
H. S. Teoh
May 19, 2012
Mehrdad
May 19, 2012
Sean Kelly
May 20, 2012
H. S. Teoh
May 20, 2012
Paulo Pinto
May 20, 2012
H. S. Teoh
May 21, 2012
Paulo Pinto
May 19, 2012
Jérôme M. Berger
May 19, 2012
Mehrdad
May 19, 2012
Sean Kelly
May 19, 2012
Paulo Pinto
May 19, 2012
David Nadlinger
May 19, 2012
Stewart Gordon
May 19, 2012
Dmitry Olshansky
May 17, 2012
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?

(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.)
May 18, 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.
May 18, 2012
On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote: [...]
> 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.

Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works.


T

-- 
Question authority. Don't ask why, just do it.
May 18, 2012
On Friday, 18 May 2012 at 16:37:31 UTC, Sean Kelly wrote:
> 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.
>
> 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.

Yeah...

The reason I asked was, I ended up calling a bunch of stuff manually (e.g. rt_moduleCtor), and when I looked at Phobos, I realized that's exactly what the Posix code already does. So I was thinking if I used Phobos with the Posix flag, it might be easier, but probably not...
May 18, 2012
On 18-05-2012 18:42, H. S. Teoh wrote:
> On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
> [...]
>> 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.
>
> Does Windows conform to the Posix spec at all? I highly doubt it, esp.
> some parts that just goes against how Windows works.
>
>
> T
>

Try doing fork() on Windows. ;)

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
May 18, 2012
On Friday, 18 May 2012 at 16:53:54 UTC, Alex Rønne Petersen wrote:
> On 18-05-2012 18:42, H. S. Teoh wrote:
>> On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
>> [...]
>>> 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.
>>
>> Does Windows conform to the Posix spec at all? I highly doubt it, esp.
>> some parts that just goes against how Windows works.
>>
>>
>> T
>>
>
> Try doing fork() on Windows. ;)

I believe Interix (i.e. Windows POSIX subsystem) handles it perfectly well, although that's not at all related to what I was asking about haha.
May 18, 2012
Am 18.05.2012 18:53, schrieb Alex Rønne Petersen:
> On 18-05-2012 18:42, H. S. Teoh wrote:
>> On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
>> [...]
>>> 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.
>>
>> Does Windows conform to the Posix spec at all? I highly doubt it, esp.
>> some parts that just goes against how Windows works.
>>
>>
>> T
>>
>
> Try doing fork() on Windows. ;)
>

Easy,

Initially Windows NT family only supported POSIX.1, due to US federal requirements, later on it was improved by Interix und SUA

http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem

More information here,
http://technet.microsoft.com/en-us/library/cc772343
fork() ==> http://technet.microsoft.com/en-us/library/cc754234


--
Paulo
May 18, 2012
On 18-05-2012 20:53, Paulo Pinto wrote:
> Am 18.05.2012 18:53, schrieb Alex Rønne Petersen:
>> On 18-05-2012 18:42, H. S. Teoh wrote:
>>> On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
>>> [...]
>>>> 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.
>>>
>>> Does Windows conform to the Posix spec at all? I highly doubt it, esp.
>>> some parts that just goes against how Windows works.
>>>
>>>
>>> T
>>>
>>
>> Try doing fork() on Windows. ;)
>>
>
> Easy,
>
> Initially Windows NT family only supported POSIX.1, due to US federal
> requirements, later on it was improved by Interix und SUA
>
> http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem
>
> More information here,
> http://technet.microsoft.com/en-us/library/cc772343
> fork() ==> http://technet.microsoft.com/en-us/library/cc754234
>
>
> --
> Paulo

Right, but that's not really Win32 out of the box. Cygwin implemented it too, in user land.

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
May 18, 2012
On Fri, 18 May 2012 09:42:54 -0700, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:

> On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
> [...]
>> 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.
>
> Does Windows conform to the Posix spec at all? I highly doubt it, esp.
> some parts that just goes against how Windows works.
>
>
> T

SUA is deprecated in Windows 8.

-- 
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/
May 18, 2012
On May 18, 2012, at 9:42 AM, "H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote:

> On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote: [...]
>> 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.
> 
> Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works.

It's called SUA these days and I believe is Posix compliant. The problem is more that the Posix spec is so loose that Posix compliance alone doesn't mean very much. Tons of stuff is isn't implemented or is implemented badly, and the command shell is just a train wreck.
« First   ‹ Prev
1 2 3 4 5