Live data from Hacker News

Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

searchcode.com

21–30 of 37 posts

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#21
post #16

So, when they get to Windows 19 do they need to skip to 21 to avoid all the 2000 checks?

There won't be a windows 20, or anything closet to that. If we're still using computers the way we are now in 20 years, then we've seriously failed as a species.

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#22

There are no good reasons to check for an OS version anyway. Checking for the platform, ok. Not the version. That can be handled with feature detection.

Sorry, but this doesn't even come close to working in the real world. If you're on the web, then this makes sense. However, on the metal, you need to know versions.

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#24
post #16

So, when they get to Windows 19 do they need to skip to 21 to avoid all the 2000 checks?

There won't be a windows 20, or anything closet to that. If we're still using computers the way we are now in 20 years, then we've seriously failed as a species.

[deleted]

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#25
post #16

So, when they get to Windows 19 do they need to skip to 21 to avoid all the 2000 checks?

There won't be a windows 20, or anything closet to that. If we're still using computers the way we are now in 20 years, then we've seriously failed as a species.

[deleted]

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#27
post #4

Earlier quoted context omitted.

There are no APIs that return a string of the product name. GetVersionEx gives you numbers. To screw up in this manner, you have to be relying on at least two layers of broken code on top of the really simple API that you should be using directly. So I don't buy this rumor at all. The number of real applications that 1) remember Windows 9x exist, 2) aren't completely broken on modern Windows anyway, and 3) go out of…

This "convulted version checking method" is the default way to do it with Java, I'm not sure if there's any other programming languages that do it as well.

It's insane to check version numbers as strings. I guess the JDK is assuming you're not actually doing anything important with those properties (eg, just writing them to a log).

Python for example wraps GetVersionEx appropriately with sys.getwindowsversion()

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#29

I don't find this search reliable at all. There are a lot of completely unrelated results. I couldn't find any related match on the 2.000+ Python results, for example. Same with C++. This is being publicized as "proof" of the rumor but it's not representative at all. The Windows C/C++ API returns a structure with version numbers [1], same with the C# one [2]. Other languages just wrap the native C API call, GetVersio…

Never underestimate a programmers ability to fuck shit up

Re: Windows 10: Code that uses 'os.StartsWith(“Windows 9”)'

#30

I don't find this search reliable at all. There are a lot of completely unrelated results. I couldn't find any related match on the 2.000+ Python results, for example. Same with C++. This is being publicized as "proof" of the rumor but it's not representative at all. The Windows C/C++ API returns a structure with version numbers [1], same with the C# one [2]. Other languages just wrap the native C API call, GetVersio…

I'm sure the API provides the information, that doesn't stop developers from doing crazy things. The rumor, whether true or false, is actually just more evidence of how Microsoft is devoted to binary compatibility. It's a funny bit, yes, but doesn't say anything bad about MS at all.
Post reply on HN