Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use refs for non-simple chained comparisons #50

Closed
STRd6 opened this issue Dec 15, 2022 · 3 comments · Fixed by #1556
Closed

Use refs for non-simple chained comparisons #50

STRd6 opened this issue Dec 15, 2022 · 3 comments · Fixed by #1556
Labels
bug Something isn't working

Comments

@STRd6
Copy link
Contributor

STRd6 commented Dec 15, 2022

Use a ref in non-simple chained comparisons so not to repeat evaluations of complex expressions.

f1(x) < f2(x) < f3(x) < f4(x)
let ref
f1(x) < (ref = f2(x)) && ref < (ref = f3(x)) && ref < f4(x)
@edemaine edemaine added the efficiency Improving efficiency of compiler or generated code label Jan 4, 2023
@edemaine
Copy link
Collaborator

edemaine commented Jan 24, 2023

Other settings where we should use refs (please add to list if you encounter any):

@JayXon
Copy link

JayXon commented Aug 7, 2024

I see that this issue is tagged as efficiency, but I think this is not just efficiency, but a correctness issue, since an expression could have side effect, see the examples in #1341 and #1344

@STRd6 STRd6 added bug Something isn't working and removed efficiency Improving efficiency of compiler or generated code labels Aug 7, 2024
edemaine added a commit that referenced this issue Oct 31, 2024
@JayXon
Copy link

JayXon commented Nov 1, 2024

it seems #1344 is still not fixed, can we keep this open or reopen #1344?

zoodogood pushed a commit to zoodogood/Civet that referenced this issue Nov 4, 2024
zoodogood pushed a commit to zoodogood/Civet that referenced this issue Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants