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="Geoff, post: 4214986"] This looks suspiciously like De Morgan's theorem but the correct expression of it would have been: !(!a || !b || !c) Why is everyone changing a logical operator into a bitwise operator for this functionality without consideration for the values of the operands? If we take the OP at face value and say, "how to short-circuit the evaluation" of: if(a && b && c) { /* Do stuff */ } It seems to me the correct answer is: { /* Do stuff */ } Because if multiple threads or parallel processors are expected to operate unconditionally on chunks of data with the same chunk of code regardless of the values of three input variables then there is no reason to initially evaluate the variables because they won't influence the order of execution. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Short-circuiting in C
Top