From: Camm Maguire <camm@enhanced.com>
To: gcc@gcc.gnu.org,gcl-devel@gnu.org, axiom-developer@nongnu.org
Subject: portable cdecl 'elliptic' function calls
Date: Mon, 28 Jul 2003 22:48:00 -0000 [thread overview]
Message-ID: <E19hFdA-0003kJ-00@intech19.enhanced.com> (raw)
Greetings! On 3 of the 11 Debian architectures (i386, m68k, and ia64),
the cdecl calling convention is available, making the following code
possible:
object
c_apply_n(object (*fn)(), int n, object *x)
{object res=Cnil;
#if 1
object *stack;
if (!(stack=alloca(n*sizeof(*stack))))
FEerror("Cannot allocate stack for elliptic call", 0);
memcpy(stack,x,n*sizeof(*stack));
res=fn();
As one might guess, this is taken from GCL and is used to call C
functions with a runtime-determined number of arguments.
I know that the portable way to do this is with a switch statement on
n, but this would always be something of a workaround, limiting the
argument list to some presumably large number, and taking up a fair
bit of space in the code.
My question is whether there is an alternative call analogous to the
one outlined above for the other 8 Debian architectures (arm,
mips(el), alpha, hppa, sparc, ppc, s390), giving an unlimited to
within system stack memory runtime-determined argument list to a C
function call on these platforms as well?
Advice much appreciated,
--
Camm Maguire camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
next reply other threads:[~2003-07-28 21:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-28 22:48 Camm Maguire [this message]
2003-07-29 9:52 ` Fergus Henderson
2003-07-31 2:40 ` Camm Maguire
2003-07-31 6:42 ` [Gcl-devel] " Mike Thomas
2003-07-31 14:53 ` Fergus Henderson
2003-08-01 1:22 ` Tom Tromey
2003-08-01 2:29 ` Tom Tromey
2003-07-29 11:37 ` [Axiom-developer] " Arthur Norman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E19hFdA-0003kJ-00@intech19.enhanced.com \
--to=camm@enhanced.com \
--cc=axiom-developer@nongnu.org \
--cc=gcc@gcc.gnu.org \
--cc=gcl-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).