Re: Patch to remove undefined C code

From: Ben Pfaff (pfaffben@msu.edu)
Date: Mon Oct 16 2000 - 15:55:08 EST


Jonathan George <Jonathan.George@trcinc.com> writes:

> > $ The order of evaluation of the function designator, the
> > $ arguments, and subexpressions within the arguments is
> > $ unspecified, ...
> >--
>
> I sit surprised and corrected. With every version of every C compiler on
> every OS I have ever used (over 100 combinations from AmigaDOS 1.1 using
> Manx C to E10000 using Kai C++) the behavior has been the same for parameter
> lists as for the comma operator in this respect.

Yes. In practice the usual question is whether the compiler will
evaluate the operands from left to right or from right to left,
but the compiler is within its rights to evaluate the operands in
any order it wants.

> Does this imply that even the evaluation of a function pointer
> is itself undefined in terms of ordering?

Yes.

> >"Premature optimization is the root of all evil."
> >--D. E. Knuth, "Structured Programming with go to Statements"
>
> Absolutely true.

Good sigmonster, have $TREAT.

> I would be really interested to see how well the kernel compiler does at
> optimizing out all of these new tmp variables in terms of the resulting
> register utilization and performance. At least an assembler code size
> comparison is in order for each of these individual cases.

I agree with you and Al Viro that the proposed fixes were less
than desirable.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:10 EST