Thoughts on std.system.OS
Jonathan M Davis
jmdavisProg at gmx.com
Sat Aug 13 04:23:35 PDT 2011
On Saturday, August 13, 2011 14:12:07 Vladimir Panteleev wrote:
> 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.
It does on at least some distros. The distro name is frequently part of the
version number. For instance, on my Arch box right now, it's 3.0-ARCH. But if
not all distros that we'd want to list do that, then that's not going to work.
And if that doesn't work, then I have no idea how you'd get your hands on the
distro name programmatically.
> > #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.
Except that you need useful, understandable version numbers to make sense. 2.6
and 3.0 are virtually meaningless on Linux (which would be the major and minor
number). Maybe the minor number will mean something with the 3 series, but
we've had 2.6 for years now, and there's an enormous difference between 2.6.3
and 2.6.33.
Even worse, major and minor numbers don't mean _anything_ on Windows. What are
you going to give? The NT kernel version? That's pretty much meaningless. As
far as Windows versioning goes, having XP, Vista, etc. are about all that's
useful, and that's in the OS enum. Maybe the service pack #1 would be useful
too, but that doesn't exactly fit in with major/minor numbers.
And I have no clue what Mac OS X and FreeBSD do.
Overall, I just don't see how the major and minor version could be of any real
value to anyone.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list