Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!masscomp!ftw From: ftw@masscomp.UUCP (Farrell Woods) Newsgroups: comp.lang.c Subject: Re: printf() problem Keywords: C printf Message-ID: <759@masscomp.UUCP> Date: 28 Apr 89 14:11:04 GMT References: <11657@hodge.UUCP> <353@secola.Columbia.NCR.COM> Reply-To: ftw@quasar.masscomp.UUCP (Farrell Woods) Organization: Concurrent Computer Corporation - Westford, Ma Lines: 21 In article <353@secola.Columbia.NCR.COM> gharris@secola.Columbia.NCR.COM (Buddy Harris) writes: >This is something that I don't understand either, but apparently >printf() evluates from right to left. Be careful with stetements like this: > printf("%d %d %d %d", i++, i++, i++, i++); >This evluates from right to left also. DO NOT depend on this being true in all cases! The compiler is free to evaluate arguments in whatever order it sees fit. Your compiler may evaluate the arguments in that printf call from right to left, but another may quite reasonably evaluate them left to right. If the expressions have side effects, and you're depending on the order in which those side effects happen, you have non-portable code. -- Farrell T. Woods Voice: (508) 392-2471 Concurrent Computer Corporation Domain: ftw@masscomp.com 1 Technology Way uucp: {backbones}!masscomp!ftw Westford, MA 01886 OS/2: Half an operating system