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="BGB, post: 4215133"] hmm, maybe: !((!a)|(!b)|(!c)) I don't know if any have mentioned this one. reasoning: (!a) will reduce the value to 0/1, allowing plain bitwise operators; if any of a/b/c is false, the result of (!a)/(!b)/(!c) is 1 (rather than 0), which will then be reversed by the final "!". but, who knows which optimizations the GPU-specific compiler may have done?... a compiler may well observe that if all of the operations are clean / non-destructive, then the as-if rule will allow optimizing away the short-circuit. or, knowing about this, they may well have just "reinterpreted" the && and || operators for their particular target, since what they have isn't strictly C anyways, and so there is no particular need for them to follow pedantic interpretations of the standard either, for that matter. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Short-circuiting in C
Top