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 !
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.
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 ...
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 ...
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 ...
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 !
:)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
Your version of Grear Cow BASIC is?
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.
So I modified my program (see attachment) ; now it works ... but it is not very "elegant" !
Last edit: Bertrand BAROTH 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. :-)
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 ...
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
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 ...
OK. My error. Sorry.
My version of GCB is v0.98.07 RC22
The attached prog compiles and runs well ; the REAL issue appears if I use "String * 5" in line 33 ...
What is the error message?
And, can you post the code with the issue? then, I can compare and not introduce another issue.
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 ...
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.
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 !
:)
Murphy.
There is a learning curve. :-)
And a debugging curve, too ?
:(
Serial and EEPROM is your friend. :-)
Never issues with EEProm ...
Last edit: Bertrand BAROTH 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.