Re: C and side-effects

From: Alexander Viro (viro@math.psu.edu)
Date: Wed May 03 2000 - 17:49:11 EST


On Wed, 3 May 2000, Cesar Eduardo Barros wrote:

>
> while ((mm->swap_cnt << 2 * (i + 1) < max_cnt) && i++ < 10)
> /* nothing */;
>
> I'm not that good at C, mas aren't expressions with side-effects ill-defined?

Not that one. Think of the order used to evaluate the arguments of &&.

> How can we be sure (short of tracking the gcc mailing lists) that i will be
> incremented after the left part of the test?

Comes from reading K&R and standards...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:13 EST