printf() problem

Farrell Woods ftw at masscomp.UUCP
Wed May 3 06:27:55 AEST 1989


In article <1367 at ndmath.UUCP> dierks at 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?

You'd have a hell of a time implementing C on some architectures if the
standard constrained argument passing like that.  The method, order,
etc. are not specified.  Some C compilers will even pass the first couple
of arguments in registers, then the rest on the stack.

Don't depend on the order of evaluation of argument expressions.

Don't depend on the order in which they are pushed onto the stack.

Don't depend that they will all be on a stack, even on stack based machines.



-- 
Farrell T. Woods				Voice:  (508) 392-2471
Concurrent Computer Corporation			Domain: ftw at masscomp.com
1 Technology Way				uucp:   {backbones}!masscomp!ftw
Westford, MA 01886				OS/2:   Half an operating system



More information about the Comp.lang.c mailing list