[lkml]   [2000]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Patch to remove undefined C code
>   [Matti Aarnio]
> > > That depends mainly on question: Does your stack grow up or down ?

Actually a combination -- which direction do arguments grow in relation
to stack growth direction, and do you have a stack push instruction.

> [Ben Pfaff]
> > No it doesn't. It depends mainly on whether the ABI for the machine
> > says that arguments are pushed onto the stack in left-to-right or
> > right-to-left order. You could do either on x86, for instance, and
> > it has nothing to do with whether the x86 stack grows up or down.

No, that's only true if your target supports stack pushes.

For instance, gcc on x86/linux will evaluate arguments right-to-left,
since it hopes to push arguments to the stack in that order. But
gcc on sparc will evaluate arguments mostly left-to-right, even though
the arguments are stored on the stack in the same layout as x86.

And actually it's more complicated than that, since I believe that
on most RISC we'll evaluate the arguments that wind up on the stack
first, left-to-right, then the arguments that wind up in registers,

On Tue, Oct 17, 2000 at 07:42:31AM +0000, Peter Samuelson wrote:
> So, if you choose left-to-right, how do you implement varargs? Keep in
> mind that prototypes are optional. I bet anything your solution is
> slower and more complex than right-to-left, as all known compilers do.

Speak ye little of "all known compilers".

It is possible to implement varargs however you like. Up, down, or
sideways, every direction is used by some target somewhere.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:41    [W:0.112 / U:6.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site