lkml.org 
[lkml]   [2000]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Patch to remove undefined C code
From
Date
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/

\
 
 \ /
  Last update: 2005-03-22 12:41    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site