On Thu, Jul 16, 2009 at 8:08 PM, Michael White<[email protected]> wrote: > Which compiler are you using?
This applies to any compiler that attempts to adhere to The Standard(s.) > Every compiler I know reads within ( ) first, and then from right to the left. No they don't. What the compilers do is first work out the value of each bit of the expression *Then* they start applying ( ) and L/R or R/L ordering and BODMAS to the _results_ of those bits. Two separate steps. They don't (have to) be done at the same time. Since the first bit (working out the values of each bit of the expression) doesn't have any order specified in The Standard (beyond the fact that at a sequence point, everything has been worked out,) then any expression that modifies a variable that is read more than once (simplifed explanation) has a value that is undefined. To repeat - the ( ) don't get 'noticed' until the values of the individual bits of the statement are worked out. -- PJH http://shabbleland.myminicity.com/com http://www.chavgangs.com/register.php?referer=9375
