Comparison fails when optimised compiled

Discussion in 'Bug Reports' started by agraham, Jul 28, 2009.

  1. agraham

    agraham Expert Licensed User

    This fragment works in the IDE but fails when optimised compiled

    Code:
    VScrollVisible = obj2.GetProperty("Visible"'Vertical scroll bar visible
    If VScrollVisible = True Then
        
    ' not reached when optimised compiled
        ...
    This compiles to

    Code:
    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.

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

    agraham Expert Licensed User

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

    Code:
    Sub Globals
       
    Dim b(2As 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
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    I see this bug too and its lies in the door library. It will be fixed soon.
    It only happens with booleans returned from the door library (as object rather than boolean) so I think that it was always there.

    Support for boolean arrays was not added yet. It is still on the list.
     
  4. agraham

    agraham Expert Licensed User

    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! :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice