Programming question regarding multiple return value syntax
So I'm just diving with real world code into IP8 only terrain.
And one of the features I'm eager to use is mutliple return value syntax.
I've read "Multiple Return Syntax" in the igor help file and IV-39 from the manual (which looks like a pure copy).
Doing something like
return ["abcd"]
End
Function Dostuff()
string str
[str] = GetString()
End
works as expected.
Very nice!
But it seems that I must get the return value as if I do
return ["abcd"]
End
Function Dostuff()
GetString()
End
it does not compile.
From reading the "Calling User-Defined Functions That Return Multiple Results" topic in the XOPManual I know that multiple return values are implemented using pass-by-reference parameters. And it seems that the igor compiler is quite strict here as it requires me to get the value.
Couldn't the compiler pretend that a value is fetched on the calling side and just ignore it?
Another drawback with multiple return value syntax is that you can no index returned numeric waves directly as you can normally do.
Make/FREE data
return data
End
Function Dostuff()
variable var = GetWave()[0]
End
October 7, 2019 at 01:36 am - Permalink