SUBs are basically commands like CLS, PRINT, and END. They don’t require parentheses, and you just call them as they exist.
CLS
PRINT “Hello World”
END
FUNCTIONs, on the other hand, give return values and generally require the use of parentheses with parameters. Think of commands like SIN, COS, and _PRINTWIDTH.
x = SIN(.2)
y = COS(.6)
w = _PRINTWIDTH(“Hello World”)
The glitch you’ve encountered is a long lasting one that simply hasn’t been hunted down and fixed yet, and the c++ compilation fail is from calling the sub with parentheses around an array element.
Let’s say we have a simple sub like this one:
SUB foo (array())
END SUB
Calling it with foo (x()) will give you the c++ failure.
Calling it as foo x(), and it all works fine.
The IDE doesn’t catch the issue as it’s not actually an invalid syntax — in fact, you might even want to use it from time to time to pass values by reference, to keep values from passing back from the sub. (Though you can’t right now, due to the glitch in it.)
Someday, somebody might get around to sorting the issue out, but this is one of our long-standing bugs that’s proven rather hard to track down and sort out. With no foreseeable ETA on a fix, it’s best to just make a mental note of it: Don’t call SUBs and use parentheses around arrays in the parameters.