Menu

If Statement doesn't Compile

kent_twt4
2007-08-05
2013-05-30
  • kent_twt4

    kent_twt4 - 2007-08-05

    This statement used to compile with GCBasic, but when upgraded to one of the latest Zip files, it doesn't.

      If DecTemp And 0x09 >= 5 Then  'Round up hundredths to tenths
        DecTemp = DecTemp + 5
      End if

    And the error message:

    ---------- Capture Output ----------
    > "C:\Program Files\GCBasic\Compile.bat" C:\PROGRA~1\CRIMSO~1\I2C\DS1721~1
    Great Cow BASIC (0.9 4/8/2007)

    Compiling C:\PROGRA~1\CRIMSO~1\I2C\DS1721~1 ...

    An error has been found:

    DS1721~1 (103): Error: Missing operand, after &

    The message has been logged to the file C:\PROGRA~1\GCBASIC\ERRORS.txt.

    Press any key to continue

     
    • Hugh Considine

      Hugh Considine - 2007-08-05

      I've found the bug, and will deal with it when I'm back home with access to FreeBASIC.

      Are you sure that that code works anyway? GCBASIC uses this order of operations:
      * / %
      + -
      = <> < > <= >=
      And, Or, Xor, Not

      So your code is (or should be) translated into something like this:
      SysTemp = 0x09 >= 5 ;should result in 255 but instead gives -1 due to the bug
      SysIfTemp = DecTemp And SysTemp
      if SysIfTemp.0 on then ...

       
    • kent_twt4

      kent_twt4 - 2007-08-06

      Quite positive it compiled, and it "seemed" to work O.K.  Not going back to the old, so will take heed of the maths order.  Grouped the statements like so, and now it compiles, Thanks!

      If (DecTemp And 0x09) >= 5 Then
      DecTemp = DecTemp + 5
      End if 

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.