printf() problem

Karl Heuer karl at haddock.ima.isc.com
Thu Apr 27 12:19:33 AEST 1989


In article <89Apr26.092233edt.18850 at me.utoronto.ca> zougas at hammer.me.UUCP (Athanasios(Tom) Zougas) writes:
>In article <11657 at hodge.UUCP> jdm at 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 at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list