Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: hobbs@steven.zko.dec.com (Steven Hobbs)
Subject: Re: why only 6 params passed in registers?
Date: 2000/01/14	[thread overview]
Message-ID: <85ocvc$ko4$1@mailint03.im.hou.compaq.com> (raw)
In-Reply-To: 85mtsp$ctb$1@news.telekabel.nl


In article <85mtsp$ctb$1@news.telekabel.nl>, "Martin Sinot" <martin@spase.nl> writes:

>If I remember correctly, only arguments which are actually
>specified can be passed in registers. So in the printf case, there
>is only one parameter passed in a register, the format string.
>The variable arguments are always passed on the stack.

You do not remember correctly.  Compile the following program on an
Alpha (I used both Compaq C and gcc):

extern void foo(char s[])
{printf(s, 1, 2.0, 3, 4, 5);}

and you will find 1,3,4,5 in r17,r19,r20,r21 and 2.0 in f18.

Notice that this example did not include <stdio.h> so the call on
printf is a "legacy" call on an undeclared function without a
prototype.  A "legacy" caller cannot tell whether the called routine
uses varargs so all calls (legacy without a prototype, prototype
without an ellipsis terminator, and prototype with an ellipsis
terminator) must use the same register argument conventions.




      reply	other threads:[~2000-01-14  5:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-12  5:00 why only 6 params passed in registers? david_morse
2000-01-12  5:00 ` Martin Sinot
2000-01-12  5:00   ` Serguei Patchkovskii
2000-01-14  5:00     ` Chris
2000-01-14  5:00       ` Serguei Patchkovskii
2000-01-14  5:00         ` Chris
2000-01-15  5:00       ` Greg Lindahl
2000-01-15  5:00         ` Chris
2000-01-15  5:00           ` Serguei Patchkovskii
2000-01-16  5:00             ` Chris
2000-01-16  5:00               ` Serguei Patchkovskii
2000-01-12  5:00 ` Alex Rhomberg
2000-01-14  5:00 ` Steven Hobbs
2000-01-14  5:00   ` Martin Sinot
2000-01-14  5:00     ` Steven Hobbs [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox