handling of if ( expr1 && expr2 && expr3 && expr4)

 

Hi,

does anybody know whether here

bool expr1,expr2,expr3,expr4;
..
expr1 = High[1]>High[2];
...
if( expr1 && expr2 && expr3 && expr4 ) { ... }

a) all expr1,..expr4 are tested to be true or

b) only the first and if expr1 == false all the others were skipped as if will be false?

Additionally if the 'ANDs' (&&) were 'ORs' (||) then if the first expr1 is true the whole if must be true so the rest could be skipped.

Does anybody know how this is executed?

Thanks in advance,

Gooly

 
gooly:

Hi,

does anybody know whether here

a) all expr1,..expr4 are tested to be true or

b) only the first and if expr1 == false all the others were skipped as if will be false?

Additionally if the 'ANDs' (&&) were 'ORs' (||) then if the first expr1 is true the whole if must be true so the rest could be skipped.

Does anybody know how this is executed?

Thanks in advance,

Gooly


In MT4 all tests are always run.

 
gooly: a) all expr1,..expr4 are tested to be true or

RTFM What do you think "the so-called "short estimate" method does not apply" means?

Thus it's demonstrably faster to use IF(A) IF(B) IF(C) and you must with divide by zero and function call with side affects (Like OrderClose/OrderSend)

 

Thank you to both!

Gooly

Reason: