1
QB64 Discussion / Re: C++ Compilation failed passing arrays as parameters
« on: February 28, 2021, 11:47:01 am »
Thank you all for the responses!
(I'm brand new to QB64 -- looking for exciting stuff to do, this is my very first pandemic. The QB64 forum is certainly a lot more alive than I thought it might be -- please nobody take this the wrong way, but you have to admit that we are kind of at one of the extremities of the internet out here! Not unlike the Earth itself, a small but interesting outpost on the edge of the galaxy -- anything to get away from Javascript, amiright? ;-) )
==
Re: try3 is declared entirely wrong and used incorrectly.
Re: try2 is used incorrectly.
Reggie says:
True, but in both cases QB64 "fell down" into the C++ error, so I added them to the sample program while attempting to isolate the compiler bug:
[1] My assumption was/is that any such errors should be picked-up by QB64 proper, and that any fall-through to the internal C++ compiler is probably a reportable bug, regardless of the code that caused it to happen.
[2] I noticed the "Compilation failed" posting a few hours before mine, but the C++ error is different so they might be separate issues?
[3] When I first saw the error, I thought, "Weird, it's QBasic 4.5 compatible, but there's a C++ guy in there trying to get out!" (It was like watching the movie Aliens, quite frankly!)
==
Re: Also, don't call the sub like try1 (cloud()). Call it like try1 cloud()
Reggie says:
Okay...I see now, that's working much better...thanks!
But now I'm confused -- the example on QB64's "FUNCTION" page shows parentheses included in FUNCTION calls. Is it different for SUB calls? Or they are optional?
[Searching...this might be interesting...]
==
Re: When you don't put a type behind it then it expects a SINGLE type. Your array is declared as an INTEGER type.
Reggie says:
Okay...I think this probably explains the problem with the sample code itself...
I see here, from the QB64 documentation:
When a variable has not been defined or has no type suffix, the value defaults to SINGLE.
(http://qb64.org/wiki/INTEGER)
Parameters passed after the procedure call must match the variable types in the SUB parameters in order.
http://www.qb64.org/wiki/SUB
And so the problem (with my code) was a kind-of subtle combination of the above two conditions...
==
Reggie says:
And so just to confirm though, there is a relatively new or under-explored compiler bug involved here? (Fall-through to C++ error)
Thanks again for all the help!
Reg
(I'm brand new to QB64 -- looking for exciting stuff to do, this is my very first pandemic. The QB64 forum is certainly a lot more alive than I thought it might be -- please nobody take this the wrong way, but you have to admit that we are kind of at one of the extremities of the internet out here! Not unlike the Earth itself, a small but interesting outpost on the edge of the galaxy -- anything to get away from Javascript, amiright? ;-) )
==
Re: try3 is declared entirely wrong and used incorrectly.
Re: try2 is used incorrectly.
Reggie says:
True, but in both cases QB64 "fell down" into the C++ error, so I added them to the sample program while attempting to isolate the compiler bug:
[1] My assumption was/is that any such errors should be picked-up by QB64 proper, and that any fall-through to the internal C++ compiler is probably a reportable bug, regardless of the code that caused it to happen.
[2] I noticed the "Compilation failed" posting a few hours before mine, but the C++ error is different so they might be separate issues?
[3] When I first saw the error, I thought, "Weird, it's QBasic 4.5 compatible, but there's a C++ guy in there trying to get out!" (It was like watching the movie Aliens, quite frankly!)
==
Re: Also, don't call the sub like try1 (cloud()). Call it like try1 cloud()
Reggie says:
Okay...I see now, that's working much better...thanks!
But now I'm confused -- the example on QB64's "FUNCTION" page shows parentheses included in FUNCTION calls. Is it different for SUB calls? Or they are optional?
[Searching...this might be interesting...]
==
Re: When you don't put a type behind it then it expects a SINGLE type. Your array is declared as an INTEGER type.
Reggie says:
Okay...I think this probably explains the problem with the sample code itself...
I see here, from the QB64 documentation:
When a variable has not been defined or has no type suffix, the value defaults to SINGLE.
(http://qb64.org/wiki/INTEGER)
Parameters passed after the procedure call must match the variable types in the SUB parameters in order.
http://www.qb64.org/wiki/SUB
And so the problem (with my code) was a kind-of subtle combination of the above two conditions...
==
Reggie says:
And so just to confirm though, there is a relatively new or under-explored compiler bug involved here? (Fall-through to C++ error)
Thanks again for all the help!
Reg