PureBasic defines #True as 1 and that creates inconsistencies
If the value attributed to True was adequate, we should be able to retrieve the values of True and False when using the built-in boolean functions. But it is not the case.
If you run the following, you can see for yourself :
Code: Select all
; Blue - août 2009
EnableExplicit
;{ ======= macros =====================
Macro QUOTES
"
EndMacro
Macro BugLINE ;; numéro de ligne
RSet(Str(#PB_Compiler_Line),8)+": ( "+ #PB_Compiler_Procedure+" ) " +
EndMacro
Macro BUG (varN)
Debug BugLINE QUOTES varN = QUOTES + Str(varN)
EndMacro
Macro Debugg ;; ligne vide
Debug ""
EndMacro
;}
Procedure Testing(vrai, faux)
Debug " Verifying constant values"
BUG (vrai)
BUG (faux)
Debugg
Debug " Verifying false = not true "
faux = ~vrai
BUG (vrai)
BUG (faux)
Debugg
Debug " Verifying true = not false"
faux = #False ; making sure we use the original PB value
vrai = ~faux
BUG (vrai)
BUG (faux)
EndProcedure
Debugg
Debug "====================================="
Debug "Using native PB True and False values,"
Testing(#True,#False)
Debug "... we get inconsistencies and irregular results"
Debugg
Debugg
Debug "To get consistent and regular results,"
Debug "====================================="
Debug "1. we explicitly define True as -1"
Testing(-1,#False)
Debugg
Debug "====================================="
Debug "2. we define True as Not False"
Testing(~#False,#False)
Debugg



