I'm
pretty sure that in standard C, && and || comparisons are optimised so that, in the case of &&, if the first comparison returns false the whole thing returns false without checking the second comparison. Similarly, in the case of ||, if the first comparison returns true the whole thing returns true without checking the second comparison.
Maybe it's not standard, but I've programmed like that before. How do I know? See this example:
ENTITY* closest = NULL;
if (closest == NULL || closest.skill[0] == 5)
closest = NULL;
While the contents of the if expression aren't useful in this situation, this is a simplified example. This gets a crash, and I think it's because it's looking for "closest.skill[0]" even when "closest == NULL", but in an ideal world (as well as programming in C, C++ or Java, if I recall correctly) that would never happen because if closest == NULL then the whole if-expression would already return TRUE.
Would it be possible in future for an "early bail" if the whole expression is already known to be true (or in the case of &&, false)?
Workarounds for this are ugly (in my actual situation I have a relatively large chunk of code in the "if" case, and my only alternatives seem to be having identical chunks for two separate cases (closest == NULL... else if closest.skill[1]...), or using an if...else if... to set a variable which is then used in the final comparison instead). Unless I've done something really stupid here

Jibb