Re: 'C' Operators precedence

Todd Larason (jtl@molehill.org)
Tue, 19 May 1998 23:18:14 -0700


On Wed, May 20, 1998 at 05:24:16AM +0100, Matthew Kirkwood wrote:
> On Tue, 19 May 1998, Richard B. Johnson wrote:
> > This is also the reason why calling a function through a
> > pointer must use 'extra' parenthesis:
> >
> > r = (*f)(a);

But, um, it doesn't. Assuming 'f' is a simple variable, not a more
complicated expression, that could just be
r = f(a);

> (a=0)+a+(a=1) could evaluate in any of a number of ways, and leave a equal
> to 0 or 1 afterwards.

Or anything else. Or ignore a completely and go wash your dog. This
modifies 'a' more than once between sequence points, and is completely
undefined behavior. (on the quality-of-implementation issue, it would be
nice if there were some high quality compilers that WOULD go wash your dog
in this case.)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu