Menu

Errormessage when bitwise operation in Subs/Functions

2017-01-28
2017-01-28
  • Frank Steinberg

    Frank Steinberg - 2017-01-28

    Hi,

    I get errormessages, when using "#option Explicit" and bitwise operations in a Sub or Function.
    Other maths do not generate errormessages.

    #chip 12f1501, 1
    #option Explicit
    
    TestByte (3)
    
    Sub TestByte(MyByte As Byte)
    
       MyByte = MyByte + 1  ; No Error while compiling
    
       MyByte = MyByte | 1  ; Error: Variable MYBYTE was not explicitly declared
       MyByte = MyByte # 1  ; Error: Variable MYBYTE was not explicitly declared
       MyByte = MyByte & 1  ; Error: Variable MYBYTE was not explicitly declared
       If MyByte.0 Then     ; Error: Variable MYBYTE was not explicitly declared
       End If
    
    End Sub
    

    The workaround is, to "Dim" the variable in the main program, but would be nice to avoid that.

    GCB version is 0.96.00 2016-12-14

    Frank

     

    Last edit: Frank Steinberg 2017-01-28
  • Anobium

    Anobium - 2017-01-28

    @Frank,

    Can you check using the attachment? I get the error on one line. Can you confirm this is the same on the same line. I need this verification to ensure we are fixing same issue.

    Thanks

     
  • Frank Steinberg

    Frank Steinberg - 2017-01-29

    Me too, but if I comment out the "If ... End If" lines, I get the error at the line with the "|" (Or).
    If I comment out this, the next line causes the error and so on.

    Frank

     
  • Anobium

    Anobium - 2017-01-29

    Thanks. I have this on the 'to do' list. Use the workaround until resolved.

     
  • Anobium

    Anobium - 2017-02-25

    Fixed in release v0.97.00 or later

     

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.