Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!ndcheg!ndmath!dierks From: dierks@ndmath.UUCP (Tim Dierks) Newsgroups: comp.lang.c Subject: Re: printf() problem Message-ID: <1367@ndmath.UUCP> Date: 28 Apr 89 23:01:01 GMT References: <163@marvin.moncam.co.uk> Organization: Math. Dept., Univ. of Notre Dame Lines: 22 From article <163@marvin.moncam.co.uk>, by paul@moncam.co.uk (Paul Hudson): < In article <89Apr26.092233edt.18850@me.utoronto.ca>, zougas@me.utoronto.ca ("Athanasios(Tom) Zougas") writes: <> In article <11657@hodge.UUCP> jdm@hodge.UUCP (jdm) writes: <> > <> > Perhaps someone could explain this printf() phenomena to me. < ... <> > printf("%x %x %x %x\n", getc(fp), getc(fp), getc(fp), getc(fp)); < <> C puts its function parameters on the stack in "reverse" order, i.e. <> ... < No. C does not have any order defined for function evaluation. Typically < compilers derived from pcc or that pass args. purely on the stack will < push in reverse order, but even this isn't defined. Don't rely on it! I understand that the _order_ of evaluation is undefined... My question is if the stack-based method of passing arguments, or the order in which the arguments are passed, is part of the C definition. The alternative seems to me to be making all functions that take a variable number of arguments non-portable. Is this the case? Tim Dierks dierks@darwin.cc.nd.edu