Thoughts on std.system.OS

Jacob Carlborg doob at me.com
Sat Aug 13 05:57:31 PDT 2011


On 2011-08-13 07:08, Jonathan M Davis wrote:
> I made a few changes to std.system to clean it up a bit and make it more
> thorough:
>
> https://github.com/D-Programming-Language/phobos/pull/186
>
> However, on reflection, I'm not convinced that the OS enum and its
> corresponding os variable along with the os_major and os_minor variables serve
> any real purpose. Their purpose appears to be to tell you at runtime which OS
> you're actually running on - as in version, not just family of OS. I don't see
> how this is actually possible outside of perhaps Windows (it's just defaulted
> to WindowsXP thus far). And if it can't really do its job, I'd just as soon
> remove it. And since it hasn't been in the documentation, it's not likely to
> break any code.
>
> Thoughts on std.system.OS? Is there a good reason to leave it? In principle,
> it's a nice idea, but I just don't see how it can deliver. And if it can't
> deliver, it should be removed IMHO. What do you think?
>
> - Jonathan M Davis

It can be usefully to detect if you're running Mac OS X 10.5, 10.6 or 
10.7. The function "Gestalt" can be used for that found in the 
CoreServices framework.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list