QB64 Phoenix Edition
Bug? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: Bug? (/showthread.php?tid=1558)



Bug? - dano - 03-18-2023

I chased this down this morning and think that this might be a bug.  I am using v 3.6.0.  From what I can tell you can omit the 'Call' command when calling a Sub and passing non-array variables, but when you call a Sub and pass an array you must have the 'Call' included.  Omitting this when passing an array will generate a 'C++ compilation failed' error.

Here is sample code:

--------------------
Call test(b$())

Sub test (b$())
    Print "HI"
End Sub
--------------------


The above compiles and works....but if the first line is any of the below iterations it will generate a 'C++ compilation failed' error - and it is not caught by the IDE:

test (b$())
test (b$)

It does not matter if you DIM or DIM SHARED for b$ either - you get the same results.  Also it does not matter if the passed variable is a integer or string - you get the same results.  I like to exclude 'Call' as I think the code looks cleaner without it, but in this case it just won't work.  It appears that it is only an issue where an array is being passed to the Sub as the code below works fine:

--------------------
test (b$)

Sub test (b$)
    Print "HI"
End Sub
--------------------

Also I wonder if the IDE needs help in this area too since the 'test (b$)' line in the FIRST example calls a Sub that requires an array, but the IDE does not catch that.

Thanks to all that dedicate work to this project !!!!
Dano


RE: Bug? - dbox - 03-18-2023

CALL is not required to call a subprocedure. Use the SUB-procedure name and list any parameters without parenthesis.

https://qb64phoenix.com/qb64wiki/index.php/CALL


RE: Bug? - TerryRitchie - 03-18-2023

Test is a subroutine and does not require the parenthesis to surround b$() when calling it.

test b$() ' Not test (b$())

SUB test (B$())
    PRINT "Hi"
END SUB


RE: Bug? - dano - 03-18-2023

(03-18-2023, 02:11 PM)TerryRitchie Wrote: Test is a subroutine and does not require the parenthesis to surround b$() when calling it.

test b$() ' Not test (b$())

SUB test (B$())
    PRINT "Hi"
END SUB

Color me learned !!!

'Call test b$()'  does not work without the parenthesis, but  'test b$()' = works ??  Interesting...I have always surrounded with parenthesis since when you use the 'Call' they have to be there.


RE: Bug? - dano - 03-18-2023

(03-18-2023, 02:10 PM)dbox Wrote: CALL is not required to call a subprocedure. Use the SUB-procedure name and list any parameters without parenthesis.

https://qb64phoenix.com/qb64wiki/index.php/CALL

Completely understood as I mentioned 'I like to exclude 'Call' as I think the code looks cleaner'.  The issue was with how it was formatted when using the Call vs not using the Call.


RE: Bug? - dbox - 03-18-2023

(03-18-2023, 02:41 PM)dano Wrote:
(03-18-2023, 02:10 PM)dbox Wrote: CALL is not required to call a subprocedure. Use the SUB-procedure name and list any parameters without parenthesis.

https://qb64phoenix.com/qb64wiki/index.php/CALL

Completely understood as I mentioned 'I like to exclude 'Call' as I think the code looks cleaner'.  The issue was with how it was formatted when using the Call vs not using the Call.

Perhaps I should have highlighted the “without parentheses” part, but Terry gave you an example which was ultimately more helpful.