ambiguous ?

T. William Wells bill at twwells.com
Mon Oct 16 19:08:47 AEST 1989


In article <20974 at gryphon.COM> bagpiper at pnet02.gryphon.com (Michael Hunter) writes:
: In the following code fragment is line 3 ambiguous from an X3J11 standpoint
: or from a historical standpoint.
:
: 1) int Ret ;
: 2)
: 3) func(Ret = func2(), Ret+30) ;

You can't tell which way the arguments will get evaluated. Some
compilers will do them left to right, others right to left. And if it
does them right to left, which I believe is the most common way, you
are in trouble.

X3J11 did not mandate any order of evaluation of function arguments
so this won't be a good idea with ANSI compilers either.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.lang.c mailing list