Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Short-circuiting in C
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Edward A. Falk, post: 4215964"] A sufficiently smart compiler would realize that if y and z have no side-effects, then their computation can be deferred until they're needed. The above code would be optimized back to the original. Now if y and z do have side-effects, then this would indeed generate different code, forcing them to be evaluated when they might not have been in the original. Note that OP wanted to force evaluation of y and z in order to remove some expensive branches. However, I think that any analysis would show that the branches are cheaper than evaluating y and z in almost all cases. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Short-circuiting in C
Top