Sender: bill AT delorie DOT com Message-ID: <3779C9A1.35125F69@taniwha.org> Date: Wed, 30 Jun 1999 19:39:13 +1200 From: Bill Currie X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.2.9 i486) MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Regparm and asm statements.. what now? References: <3778E043 DOT D8D5F4 AT inti DOT gov DOT ar> <19990629185744 DOT C4792 AT tabor DOT ta DOT jcu DOT cz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Jan Hubicka wrote: > > > Eli: > > What happens if someone compiles a program without including the headers > > that declare the prototype? > > > > According to ANSI C, users can legitimately do that, and still assume > > they get a working program. IMHO, broken spec. Nuff said. > You will get broken program with regparm anyways, because the function > with variable number of arguments are called using stack convention. > So you need to include stdio to get regparmized hello world working. > I am not sure if this is OK and later this can be fixed in gcc2.96. > It will require some nasty hacks to varrargs stuff. On archs that use N (usually 4) regs by default (eg i860, pa-risc, most risc?), the convention is that the first N parameter words (not necessarily parameters themselves, depends on param size) are *ALWAYS* passed in the registers (with FP parms being sent in both int and fp regs), no matter what, with any additional parameters passed on the stack. The varargs function then has prologue code that saves the incoming regs on the stack. The va_args `macro' does the right thing for accessing the incoming params. I don't know how of even if this can be made to work for the i386 (though I don't see why not), but do we want to? Anyway, varargs stuff need not be a problem. So long as the calling conventions match, no prototype is truely needed. Bill -- Leave others their otherness.