I'm sorry if this is a silly or stupid question, but I couldn't find anything in the faq, and I'm not quite sure what search terms to use to find something like this:
Say I have two functions, f() and g(). We'll say they either return 0 or 1. f() is very fast, and has a low likely hood of being true and g() is much slower than f().
Consider the statement
Obviously, if i know f() is false, I'm wasting my time checking g().Code:if (f() && g()) { ... }
Does the if statement break as soon as it sees that f() is false? Or does is run all the functions first and then check the logic later? If it does then it would be faster (maybe just a little less readable) to write
Or maybe the compiler optimizes it? Does it depend on the compiler? Thanks in advanceCode:if (f()) { if (g()) { ... } }
nb