[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] How does Chicken know the # of arguments to a functi
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] How does Chicken know the # of arguments to a function |
Date: |
Mon, 20 Dec 2004 10:03:51 +0100 |
On Mon, 20 Dec 2004 08:34:43 +0000, John Lenz <address@hidden> wrote:
>
> Yeah, and because all arches push the parameters onto the stack in reverse
> order, so even if f_22 is called with a different number of parameters the
> first parameter c will still be valid. I guess on some arches like sparc
> the first few parameters are passed in registers, but then c is still valid
> too. And chicken can get away with it because if you call a function with
> more arguments than the function expects, normally that would leak stack
> space (unless the caller freed the args, guess depends on calling
> convention). But that isn't a problem for chicken because functions never
> return and the stack is collected with a longjmp.
>
> Is that right?
>
Yes, that's correct (and procedures that expect a dotted argument list
simply use stdarg functionality)
So the only requirement for calls to Chicken-generated
functions is cdecl calling convention.
cheers,
felix