probiner Posted February 13, 2018 Share Posted February 13, 2018 (edited) 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) ; } And it can be "solved" in multiple ways: If for example I comment out the clamp part it passes: If instead I remove the +.1 from foo it works as well. 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 February 13, 2018 by probiner Quote Link to comment Share on other sites More sharing options...
f1480187 Posted February 13, 2018 Share Posted February 13, 2018 Submit a bug. Compute intermediate variables explicitly, as a workaround. Quote Link to comment Share on other sites More sharing options...
probiner Posted February 13, 2018 Author Share Posted February 13, 2018 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. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted February 13, 2018 Share Posted February 13, 2018 I think the problem is "a + 0.1" expression used as argument of custom function called inside different custom function, and when both functions defined inside third function (wrangle). Intermediate "float a_ = a + 0.1;" solves it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.