This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Function Argument Question
Michael Meissner wrote:
> On Wed, Dec 13, 2000 at 10:32:34AM -0600, Davy Durham wrote:
> > Michael Meissner wrote:
> >
> > >
> > > Not necessarily. The compiler on many machines receives the first n arguments
> > > in registers and not on the stack. Some machines reserve space on the stack to
> > > store these arguments, and some do not, in which case it stores the argument at
> > > some location in the stack frame. Also for char/short/float arguments if a
> > > prototype was not in scope the compiler receives the argument as the widened
> > > type and then converts it to the narrowed type, and stores it some place on the
> > > stack.
> > >
> >
> > Yup, but I found the extension for a function attribute:
> >
> > void func(...) __attribute__ ((regparm(0)));
> >
> > which is supposed to make it not pass any args in registers..
>
> Which is machine specific to the x86. All of the world is not an x86.
Yeah.. I see that regparm is x86 specific now from the doc... I overlooked that the
first time I read it.. This would perhaps be nice on the rest of the supported
platforms....
But I really am only targeting the x86 platform for now.... The code I'm using to
call C functions is in a small separate .c file (my code is C++ but gcc 2.95.2 has a
problem/bug with C++ and __builtin_apply)... And I was expecting to perhaps re-write it
when/if I port this thing...
However, another post from Richard Henderson mentions libffi..... I'm gonna go
check this out.... It may save my buttocks..
--Davy