Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!decvax!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: printf() problem Keywords: C printf Message-ID: <12815@haddock.ima.isc.com> Date: 27 Apr 89 02:19:33 GMT References: <11657@hodge.UUCP> <89Apr26.092233edt.18850@me.utoronto.ca> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 12 In article <89Apr26.092233edt.18850@me.utoronto.ca> zougas@hammer.me.UUCP (Athanasios(Tom) Zougas) writes: >In article <11657@hodge.UUCP> jdm@hodge.UUCP (jdm) writes: >> printf("%x %x %x %x\n", getc(fp), getc(fp), getc(fp), getc(fp)); >>[was found to evaluate the rightmost getc() first.] > >It would happen in any C. No. Not all hardware has a downward-growing stack, and even on those that do, not all C compilers evaluate function arguments in the same order that they are pushed. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint