|
 |
Warp wrote:
> From the compiler's point of view the implementation of this is rather
> simple: All the function parameters are pushed onto the stack, and then
> the foo() function simply pops them from the stack.
Well, technically, the foo() function indexes into the stack (with a
compiler-provided macro to move the stack pointer into a pointer
variable, basically), and then whoever called foo() has to pop the
arguments. Which is one reason you don't see many "ret N" instructions
in compiled C code - the callee never knows how many arguments the
caller pushed. (Altho you'd think that's something the compiler could
optimize if you didn't have a variable numbers of arguments for a
particular function.)
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
 |