Comparison fails when optimised compiled

agraham

Expert
Licensed User
Longtime User
This fragment works in the IDE but fails when optimised compiled

B4X:
VScrollVisible = obj2.GetProperty("Visible") 'Vertical scroll bar visible
If VScrollVisible = True Then
    ' not reached when optimised compiled
    ...

This compiles to

B4X:
if (LCompareEqual(var__main_vscrollvisible,@"true"))

The reason for failure is that that the Door library returns "False" or "True" for Booleans and in this case LCompareEqual does a case-sensitive comparison against "true" which therefore fails.

B4X:
return (lSide == rSide);
Has something changed in 6.80? If not I'm astonished that I haven't noticed this before! :confused:
 

agraham

Expert
Licensed User
Longtime User
Further problems with Booleans and case-sensitivity :(. I thought we'd fixed this. http://www.b4x.com/forum/bug-reports/1474-conditional-check-failing-boolean-type.html

B4X:
Sub Globals
   Dim b(2) As Boolean
End Sub

Sub App_Start
   b(0) = False
   b(1) = True
   If b(0) = False Then
      Msgbox(b(0), 1) 'IDE and optimise both fail
   End If
   If B(1) = True  Then
      Msgbox(b(1), 1) 'IDE and optimise both fail
   End If
   If Not(B(0)) Then
      Msgbox(b(0), 2) 'IDE and optimise both work
   End If   
   If B(1)  Then
      Msgbox(b(1), 2) 'IDE and optimise both work
   End If   
End Sub
 

agraham

Expert
Licensed User
Longtime User
Support for boolean arrays was not added yet. It is still on the list.
I thought I remembered checking that, obviously not. :eek:
My aging memory is obviously not what it used to be. :confused:
A bit like the rest of me! :(
I 'll need to start festooning the monitor with Post-it notes before long! :)
 
Top