Mail Archives: djgpp-workers/1999/06/30/03:39:05
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.
- Raw text -