------- Comment #8 from pinskia at gcc dot gnu dot org  2006-04-18 00:21 -------
(In reply to comment #7)
> (In reply to comment #6)
> > In C, there is no ordering left to right, please go read the C FAQ at:
> > http://www.eskimo.com/~scs/c-faq.com/expr/index.html
> > subpage:
> > http://www.eskimo.com/~scs/c-faq.com/expr/comma.html
> The problem has nothing to do with ordering. It is in because arguments are
> evaluated not completely before the next one is evaluated. 

Even then, the order inside the epxressions is not specified which means
a+b+c+d can be such that the a, b, c, and d subexpressions are in any order as
long as there are not squence points, even then it is only the a partial
ordering.


For an example:

(a, b) + (c, d) + (e, f)
can be evaulated in the following order and would be still be valid:

a c e b d f add add
or

a b c e d f add add

as long as the ordering of a comes before b and c comes before d and e comes
before f, it is valid.  This is what is meant by partial ordering.

therefor in your orginal expample we have:

f ("", OP0(f0()), OP1(f1()), OP2(f2()));

the ordering here of each sub expression is not specified in that
f0() might come before f2() but it does have to come before the call to f and
the operation OP0 just because of dependicies.

Hopefully this explains what is going on here and why this bug is invalid and
is a dup of PR 11751.

What you need to think of is that the comma in a function call is just a
seperator and there is no evaulation requirement on which expression (or
subexpression) gets evaulated first in the same way:

(a++ + b++) + (a++ + b++);

there is no requirment which a++ (or b++) is evaulated first.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27153

Reply via email to