order of evaluation parse date s - (nf)
utzoo!decvax!cca!ima!johnl
utzoo!decvax!cca!ima!johnl
Sun Feb 27 03:24:08 AEST 1983
#R:houxj:-22000:ima:15900002:000:735
ima!johnl Feb 26 12:53:00 1983
Re: table[i++] = ++i;
The term "expression" in K&R refers to the entire expression (remembering
that = is syntactically just an operator.) Ergo, the compiler can
legitimately fool with both of the ++ operators.
If there's ever going to be an ANSI C standard, we'll have to straighten
this sort of thing out. A while ago I posed a similar problem:
a = foo(i++);
asking whether the ++ has to be done before foo() is called. Strictly,
K&R doesn't appear to require it, but in practice many programs assume that
it is, so real compilers usually do so. (And please don't send out your
opinion on the right thing to do; we beat this dead horse already.)
John Levine, decvax!yale-co!jrl, ucbvax!cbosgd!ima!johnl, research!ima!johnl
More information about the Comp.lang.c
mailing list