Thoughts on std.system.OS

Vladimir Panteleev vladimir at thecybershadow.net
Sat Aug 13 04:12:07 PDT 2011


On Sat, 13 Aug 2011 13:51:47 +0300, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> Also, if you parse the value from
> uname, it generally has the distro's name in it, and as long as a  
> particular
> distro is consistent in how it puts its name in that string, it should be
> possible to parse out the name and determine what the correct OS enum  
> value
> is.

Really? I've *never* seen the `uname -a` shell command (which I assume is  
just a thin syscall wrapper) print out the distro name.

> #2 and #3 don't really make sense between OSes, and I'd argue that they  
> don't
> make much sense period. I don't know what they'd mean on Windows in any
> meaningful way. On Linux, I suppose that they could be the major and  
> minor
> numbers of the kernel (e.g. 2 and 6 or 3 and 0), but that's pretty  
> useless on
> Linux, given that they don't change very often. At this point, there  
> would
> only really be two options: 2.6 and 3.0. And I don't know how major and  
> minor
> could be applied to OS X or FreeBSD.
> So, with some work, it does seem like it could be possible to do #1,  
> which
> might be useful, but I don't see much point in #2 or #3.

While perhaps abstract version numbers don't make much sense to programs,  
they can be useful information for the program's users. For example,  
adding OS version numbers to log files may help troubleshooting.

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list