Jump to content

VEX:: User-defined functions calls problems


probiner

Recommended Posts

I don't usually meddle with functions in VEX, but today decided to give it a go since I wanted to have some functions being used by other functions.

I'm having issues calling functions inside functions. The code below for example will trigger errors.

float foo(float a, b) {
    a = clamp(a, 0, 1) ;
    return a + b ;
}

float bar(float a, b) {
    return foo(a+.1, b+.1) ;
}

zTsMZvh.gif

And it can be "solved" in multiple ways:

If for example I comment out the clamp part it passes:
bwBsUBP.png

If instead I remove the +.1 from foo it works as well.
JnilxBn.png

I have other examples where such simple corrections and the multiple corrections don't work or are not straightforward so what I'm after is understanding what's the main cause of this. Either I'm missing some method here ( I did try C++ style declaration / definition) or maybe there's some issue with calling a functions from a function.

Cheers

PRB_RFE_VEXFunctionCallBug.hiplc

Edited by probiner
Link to comment
Share on other sites

15 minutes ago, f1480187 said:

Submit a bug. Compute intermediate variables explicitly, as a workaround.

That's the issue @f1480187 I could patch here and there, but it's not clear what it is as patching on either function will do... But it's no standard.

I did file a bug report, thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...