Code: Select all
EnableExplicit Define f1 = #False Define t1 = #True Define f2 = #False Define t2 = #True ; AND and OR have the same priority, so they are evaluated from left to right If #False And #True Or #False And #True ; FALSE Debug "T" Else Debug "F" ; OK EndIf If f1 And t1 Or f2 And t2 ; again the same Debug "T" Else Debug "F" ; OK EndIf If ((f1 And t1) Or f2) And t2 ; equivalent to the above Debug "T" Else Debug "F" ; OK EndIf If (f1 And t1) Or f2 And t2 ; this too should be equivalent Debug "T" ; WHAT THE HELL ? Else Debug "F" EndIf
EDIT: I just found this was actually already reported by Trond in ... 2009 -> http://www.purebasic.fr/english/viewtop ... =4&t=37904
2 0 0 9
Come on, how a compiler can fail on some boolean expression and left alone with a bug like this ?
EDIT: another nice thread about this -> https://www.purebasic.fr/english/viewto ... =4&t=65911