From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,f6dda81e7269c676 X-Google-Attributes: gid111c93,public From: hobbs@steven.zko.dec.com (Steven Hobbs) Subject: Re: why only 6 params passed in registers? Date: 2000/01/14 Message-ID: <85ocvc$ko4$1@mailint03.im.hou.compaq.com>#1/1 X-Deja-AN: 572784033 Distribution: world References: <85hhsi$lkj$1@nnrp1.deja.com> <85lsaj$o6m$1@mailint03.im.hou.compaq.com> <85mtsp$ctb$1@news.telekabel.nl> X-Complaints-To: usenet@mailint03.im.hou.compaq.com X-Trace: mailint03.im.hou.compaq.com 947894060 21252 16.31.32.149 (14 Jan 2000 23:54:20 GMT) Organization: Compaq Computer Corp Reply-To: steven.hobbs@compaq.com NNTP-Posting-Date: 14 Jan 2000 23:54:20 GMT Newsgroups: comp.os.linux.alpha In article <85mtsp$ctb$1@news.telekabel.nl>, "Martin Sinot" 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 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.