Advertisement
MageKing17

Untitled

Feb 17th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <z64555> Does anybody know how multiple compares are handled inside of an if statement?
  2. <z64555> if( (x == true) || (y == true) || (z == true) )
  3. <z64555> My guess is that the compares are evaulated before the branching/jump command is executed
  4. <z64555> but it's likely compiler specific
  5. <zookeeper> well i don't _know_ if it's true always, but i'd expect it to evaluate one after another and stop as soon as one evaluates to true
  6. <z64555> that would be the optimal execution speed, yes
  7. <zookeeper> i'm pretty sure no mainstream compiler would have all of them evaluated no matter what, but what i don't know is whether the language mandates that or not
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement