Path: utzoo!attcan!uunet!bu.edu!rpi!zaphod.mps.ohio-state.edu!mips!sgi!shinobu!odin!pkr From: pkr@sgi.com (Phil Ronzone) Newsgroups: comp.sys.sgi Subject: Re: Fun and games with ++ operators Message-ID: <1990Sep28.223417.7571@odin.corp.sgi.com> Date: 28 Sep 90 22:34:17 GMT References: <9009211425.AA04291@snowhite.cis.uoguelph.ca> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 18 In article <9009211425.AA04291@snowhite.cis.uoguelph.ca> mike@SNOWHITE.CIS.UOGUELPH.CA writes: > printf("%d %d\n", a[i++], a[i++]); > Depending on the order of evaluation of function arguments, I would expect >this code to generate "6 5" or "5 6". But instead it says "5 5", which >confuses me a bit. Do all pre/post increment/decrement operators only >take effect after the current source line, or what? I did check the value >of 'i' on the next line, and it was indeed 2, so that part works. Such behaviour is ill-defined and I thought that K&R had an explicit warning about it. I.e., don't do that kind of stuff, especially in passing arguments! -- <----------------------------------------------------------------------------> Philip K. Ronzone S e c u r e U N I X pkr@sgi.com Silicon Graphics, Inc. MS 9U-500 work (415) 335-1511 2011 N. Shoreline Blvd., Mountain View, CA 94039 fax (415) 969-2314