Menu

Some strange compiler errors

2020-09-29
2020-10-01
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-29

    Hello again.
    Look at the attached program. Compilation produces some errors that I cannot understand. I can remove the errors at line 68, 84 and 93 if I remove the * 5 in line 33, but error at line 82 still remains. What is going on ? I noticed that operations on strings are the Achilles heel of GC Basic ... And I know that program cannot reach line 150, I test it "step by step". Thanks for any answer !

     

    Last edit: Bertrand BAROTH 2020-09-29
  • Anobium

    Anobium - 2020-09-29

    Your version of Grear Cow BASIC is?

     
  • Anobium

    Anobium - 2020-09-29

    The code is inccorect. You are assigned strings to the Subroutine method. This will not work.
    The variable names are all mixed up where you use Sub names for the strings.
    And, I would not concat more than once on a line.

    My hack is attached.

    The compiler should have warned you that you were assigned a string to the Sub.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-29

    So I modified my program (see attachment) ; now it works ... but it is not very "elegant" !

     

    Last edit: Bertrand BAROTH 2020-09-29
    • Anobium

      Anobium - 2020-09-29

      Well done. CONCAT should remain single additions.

      String CONCAT is on the list to be resolved. See https://sourceforge.net/p/gcbasic/discussion/579125/thread/8aafd62637/?limit=250#2372 and search for CONCAT.

      The root cause was the assigning strings to the SUB name. There really confused things. :-)

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-29

    Beside this, I noticed that it is well possible to transmit STRINGS as an argument to a subroutine, but not as variable, only AS LITTERALS ; the attached program compiles and runs without any issues ! Strange ...

     
    • Anobium

      Anobium - 2020-09-29

      You can pass strings as arguements. How would HSERPRINT work? :-)

      The code. I just scanned. Create a simple example that I review. As simple example should only be the essencce of the issue.

      Evan

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-29

    I modified again ... If You look, the variable and Sub names were NOT the sames : for Sub it was Commander_VR3 (with "r" at the end of the first word), for the string Commande_VR3 (without "r" ) ; to avoid confusion I renamed the subroutine. The attached prog compiles and runs well ; the REAL issue appears if I use "String * 5" in line 33 ...

     
    • Anobium

      Anobium - 2020-09-29

      OK. My error. Sorry.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-29

    My version of GCB is v0.98.07 RC22

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-10-01

    The attached prog compiles and runs well ; the REAL issue appears if I use "String * 5" in line 33 ...

     
    • Anobium

      Anobium - 2020-10-01

      What is the error message?
      And, can you post the code with the issue? then, I can compare and not introduce another issue.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-10-01

    The error messahes are :
    Compilation_crash.gcb (70): Error: Array COMMANDE has not been declared
    Compilation_crash.gcb (87): Error: Array COMMANDE has not been declared
    Compilation_crash.gcb (95): Error: Array COMMANDE has not been declared
    The code is attached ...

     
  • Anobium

    Anobium - 2020-10-01

    Thank you.

    This string issue: The issue here is the size being specified in the parameter definition.

    Since the string is passed by reference, there is no real reason to give a size. Removing the size removes the error message. Perhaps the best solution is to remove the error message, or, add a new error message when the string being passed 'in' is too small.

    The workaround is to not specify the size in the current release.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-10-01

    I notice that many issues that I had with GCB were caused by strings ! Using strings should be forbidden to such users like me : call me ... Murphy !
    :)

     
  • Anobium

    Anobium - 2020-10-01

    Murphy.

    There is a learning curve. :-)

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-10-01

    And a debugging curve, too ?
    :(

     
    • Anobium

      Anobium - 2020-10-01

      Serial and EEPROM is your friend. :-)

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-10-01

    Never issues with EEProm ...

     

    Last edit: Bertrand BAROTH 2020-10-01
    • Anobium

      Anobium - 2020-10-01

      When debugging use EEProm in preference to Serial as the serial uses a lot more resources. And, as you say the Eeprom is reliable.

      And, when using Serial for debug use HSerSend not HSerPrint for debug as this will remove table handling creating less comple code.

      This is my advice for root cause analysis.

       

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.