Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: printf() problem Message-ID: <1989Apr30.001231.25122@utzoo.uucp> Organization: U of Toronto Zoology References: <163@marvin.moncam.co.uk> <1367@ndmath.UUCP> Date: Sun, 30 Apr 89 00:12:31 GMT In article <1367@ndmath.UUCP> dierks@ndmath.UUCP (Tim Dierks) writes: > 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? No definition of C mandates a stack, or any ordering of arguments within anything. Variadic functions need to use non-portable machinery to pick up their arguments, although modern practice is to encapsulate said machinery inside macros with portable interfaces, like or . Stacks are actually usually a bad way of passing arguments. Passing at least the first two or three parameters in registers is often superior. (Although it complicates etc., and can break crufty old programs.) -- Mars in 1980s: USSR, 2 tries, | Henry Spencer at U of Toronto Zoology 2 failures; USA, 0 tries. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu