Re: C and side-effects

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Wed May 03 2000 - 20:18:08 EST


> maybe im reading the thread wrong, but Cesar is saying the code
> while ((mm->swap_cnt << 2 * (i + 1) < max_cnt) && i++ < 10)
> does not guarentee that the expression to the left of && occurs prior to
> "i++" -- and he is Right,

Read the spec ;)

> because the C standard does *not* specify this. proof is in K&R, where they
> explicitly mention compiler design or optimization can change compound

Read the spec harder. && and || have specific guarantees made. & and | do not.

-
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