Re: Verify and expression
Frederick Gotham wrote:
Alf P. Steinbach:
The question is whether in the expression
(A0? A1 : A2 ) + (B0? B1 : B2)
it's possible that A0 and B0 are both evaluated before any
of A1, A2, B1 or B2?
My current understanding is as follows:
The order of evaluation of the operands of the built-in
addition operator is unspecified. One restraint though is
that the operands can't be evaluted concurrently, i.e. one
operand must complete its evaluation prior to the second
operand beginning its evaluation.
What makes you say that? A compiler most definitly is allowed
to evaluate the two operands in parallel, and it would be a very
poor compiler that didn't, at least when optimization is active.
The only restriction concerning parallelisation (other than
those due to sequence points) is that code in two functions may
not execute in parallel---once the sequence point of calling a
function has been executed, no further code in the expression
(including that of calling another function) may be executed
until the sequence point of returning from that function has
been executed. (Modulo "as if", of course.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]