Talk:Short-circuit evaluation: Difference between revisions

Line 58:
* In ''Z = F(X) .AND. Y'', the ''F(X)'' part may, or may not, be evaluated. This could of course be a problem if ''F'' has side effects.
* However, in ''Z = F(X) . AND. G(Y)'', if ''F(X)'' has side effects that change the value of ''G(Y)'', this is not standard conformant: ''The evaluation of a function reference shall neither affect nor be affected by the evaluation of any other entity within the statement.'' (7.1.8)
 
Therefore, you cant rely on short-circuiting in Fortran, and you have to use a nested IF, as Paddy3118 remarks. Even if one particular Fortran compiler guarantees short-circuit evaluation (maybe with a command-line option), using this feature would not affect standard conformance of the program, but it could certainly affect its successful execution.
 
[[User:Arbautjc|Arbautjc]] ([[User talk:Arbautjc|talk]]) 10:27, 30 April 2015 (UTC)
Anonymous user