#PB_Compiler_OS constant for latest Windows 10 update

Just starting out? Need help? Post your questions and find answers here.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

#PB_Compiler_OS constant for latest Windows 10 update

Post by Andre »

The latest Windows 10 version isn't matching anymore with the available #PB_OS_Windows_10 constant, so we need a new one ("...10_1"?) for using related CompilerIf statements etc.

Thank you!
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_OS constant for latest Windows 10 update

Post by Little John »

[deleted]
Last edited by Little John on Sat Jul 21, 2018 8:55 pm, edited 1 time in total.
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: #PB_Compiler_OS constant for latest Windows 10 update

Post by luis »

Andre wrote:The latest Windows 10 version ...
I think it would be useful to know what ver from the command prompt it's saying.

Code: Select all

Microsoft Windows [Version x.y.z.w]
As long as the first number is 10, I don't see why PB can't continue to recognize any win version as Win10 at least.

Does it return "#PB_OS_Windows_Future" ?
"Have you tried turning it off and on again ?"
A little PureBasic review
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_OS constant for latest Windows 10 update

Post by Little John »

ver wrote:Microsoft Windows [Version 10.0.17134.165]

Code: Select all

; PB 5.70 beta 1 (x64)

Debug #PB_Compiler_OS    ; -> 1
Debug #PB_OS_Windows     ; -> 1

Debug #PB_OS_Windows_10  ; -> 110
Debug OSVersion()        ; -> 110
This looks OK to me, and I think my previous message was based on an error:
I compared #PB_Compiler_OS with #PB_OS_Windows_10, and both are not equal.
But now I think that #PB_OS_Windows_10 is only meant for comparison with the result of OSVersion(). These values are equal here.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: #PB_Compiler_OS constant for latest Windows 10 update

Post by Andre »

I can confirm the same Debug output like LittleJohn showed.

I stumpled across this "problem" using #PB_Compiler_OS, which gives 1 here and this way

Code: Select all

CompilerIf #PB_Compiler_OS >= #PB_OS_Windows_10
couldn't be used anymore to react on Windows version = 10 or newer (as all previous versions return smaller values).

My fault?
Or is here really something missing in relation with #PB_Compiler_OS?
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: #PB_Compiler_OS constant for latest Windows 10 update

Post by luis »

@Andre

#PB_Compiler_OS like the name suggests is the target OS for the compiler you are using. For example "Windows", not Windows 7, 8, 10, ecc.

OsVersion() checks at runtime the version of the OS, so its return value can be compared to #PB_OS_*

#PB_Compiler_OS possible values are also documented as follows and so it should be compared just against these values:
#PB_Compiler_OS : Determines on which OS the compiler is currently running. It can be one of the following values:

#PB_OS_Windows : The compiler is running on Windows
#PB_OS_Linux : The compiler is running on Linux
#PB_OS_MacOS : The compiler is running on Mac OS X
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: #PB_Compiler_OS constant for latest Windows 10 update

Post by Andre »

@luis: You're right, thank you for the clarification :D

According to the manual the CompilerIf statements can only check the system (Win, Linux, MacOS), but not a specific version (that's what I assumed, my mistake).

So I'll move this topic to Coding questions now... ;-)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply