PB 5.70 64 #PB_Processor_x86 fails?

Just starting out? Need help? Post your questions and find answers here.
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

PB 5.70 64 #PB_Processor_x86 fails?

Post by Justin »

I am running PB 64 and this shows x86 ?

Code: Select all

CompilerIf #PB_Processor_x86
	Debug "x86"
CompilerEndIf
Mint 64
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: PB 5.70 64 #PB_Processor_x86 fails?

Post by #NULL »

You are only checking the value of the constant, which always has a value. You need to compare it to #PB_Compiler_Processor

Code: Select all

CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
   Debug "x86"
CompilerEndIf
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB 5.70 64 #PB_Processor_x86 fails?

Post by Justin »

i forgot that, thanks
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: PB 5.70 64 #PB_Processor_x86 fails?

Post by Josh »

And again write immediately as a bug report.

Just think about whether such a bug can occur without there being hundreds of bug reports already.

By the way, there is also a forum for questions!!!

@Any Mod:
Please move this to the garbage.
sorry for my bad english
DarkDragon
Addict
Addict
Posts: 2228
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: PB 5.70 64 #PB_Processor_x86 fails?

Post by DarkDragon »

Be thankful for bug reports, not angry about them.
Just think about whether such a bug can occur without there being hundreds of bug reports already.
This way no serious all-damaging bug would be ever reported. E.g. the floating point recursion bug we had a while ago.

Usually bug trackers also keep track of non-bugs because this way you can find many conceptual issues where the intention is not clear to the users.
bye,
Daniel
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: PB 5.70 64 #PB_Processor_x86 fails?

Post by Little John »

#NULL wrote:You are only checking the value of the constant, which always has a value. You need to compare it to #PB_Compiler_Processor

Code: Select all

CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
   Debug "x86"
CompilerEndIf
You are right, of course. And what you are posting is correct and proper PureBasic code.

However, it's a pity that PB sometimes forces us to write such counterintuitive code. Maybe that's the reason why people repeatedly have problems with code like this. #PB_Processor_x86 really is a named constant (its value is 2, at least on Windows). But while #PB_Compiler_Processor also looks like a constant, it actually is a compiler function in disguise. That is irritating.

If it would be possible to write the code like this

Code: Select all

CompilerIf PB_Compiler_Processor() = #PB_Processor_x86
   Debug "x86"
CompilerEndIf
then it would become obvious how it actually works.

BTW, in this particular case, there is an official compiler function that we can use instead:

Code: Select all

CompilerIf SizeOf(Integer) = 4
   Debug "x86"
CompilerEndIf
Post Reply