[lkml]   [2000]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Patch to remove undefined C code
Peter Samuelson wrote:
> [Matti Aarnio]
> > > That depends mainly on question: Does your stack grow up or down ?
> [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.
> 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.
> Peter

You are correct that in C the rightmost argument is always
at the open end of the stack, and that varargs require that.
The opposite is called the Pascal convention.

This thread has incorrectly identified the order of
expression evaluation with the physical stack layout of the
resulting values. The two properties are orthogonal. The
compiler is free to evaluate arguments in any order, and
knows which stack slot gets each result.

For instance, evaluation reordering might be done to
optimize cache coherency. It is conceivable that a SMP-aware
compiler would evaluate heavyweight arguments in parallel
(though currently Linux would not support that).

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.125 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site