Xref: utzoo comp.lang.c:40594 alt.folklore.computers:13245 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!world!madd From: madd@world.std.com (jim frost) Newsgroups: comp.lang.c,alt.folklore.computers Subject: Re: Beautiful side-effects! (q = q++) Message-ID: <1991Jun29.180635.19115@world.std.com> Date: 29 Jun 91 18:06:35 GMT References: <15520@exodus.Eng.Sun.COM> <1991Jun25.151408.1024@ux1.cso.uiuc.edu> <1991Jun26.154734.14439@dsuvax.uucp> <1991Jun27.163643.1223@tc.fluke.COM> Organization: The World @ Software Tool & Die Lines: 16 kurt@tc.fluke.COM (Kurt Guntheroth) writes: >> "q = q++;" SHOULD leave q unchanged >K&R says nothing about when the increment's side effect is processed, and >ANSI says specifically that it is undefined. Both K&R 1 and 2 say that the behavior is undefined (p 50 and 53-54 respectively, I know 'em by heart) as does ANSI. With respect to the gcc versus vcc code difference: note that gcc produced more efficient code by evaluating in a different order. This is precisely the reason K&R give for leaving the order undefined. Happy hacking, jim