Function Argument Evaluation

John Love-Jensen eljay@adobe.com
Wed Dec 6 16:48:00 GMT 2006


Hi Michael,

Is the issue "order of function argument evaluation", or "order function
arguments are pushed on the stack"?

The former is undefined, as already discussed.

The latter is "defined" by a variety of mutually incompatible calling
conventions, which answer such questions as:
+ how is the function name "mangled" (leading underscore? uppercased? C++
mangled?) 
+ are arguments pushed left to right, or right to left; and perhaps into
registers (e.g., DOS INT calls, or Amiga OS calls)
+ how is the return value returned to the caller
+ who is responsible for cleaning up the stack: the caller or callee

I'm sure that exception handling and stack unwinding and other ABI
considerations plays into the equation too, somehow, but I've just thrown up
my hands and said "It's PFM" and let the compiler GNUrus figure out the
hairy, scary details.

For example, MSVS6 has these:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/ht
ml/_core_argument_passing_and_naming_conventions.asp

GCC 4.1.1 has these (interspersed amongst other function attributes):
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Function-Attributes.html

HTH,
--Eljay



More information about the Gcc-help mailing list