From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24379 invoked by alias); 28 Jul 2003 21:34:09 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 24372 invoked from network); 28 Jul 2003 21:34:08 -0000 Received: from unknown (HELO intech19.enhanced.com) (66.134.96.17) by sources.redhat.com with SMTP; 28 Jul 2003 21:34:08 -0000 Received: from camm by intech19.enhanced.com with local (Exim 3.35 #1 (Debian)) id 19hFdA-0003kJ-00; Mon, 28 Jul 2003 17:34:08 -0400 To: gcc@gcc.gnu.org,gcl-devel@gnu.org, axiom-developer@nongnu.org Subject: portable cdecl 'elliptic' function calls Message-Id: From: Camm Maguire Date: Mon, 28 Jul 2003 22:48:00 -0000 X-SW-Source: 2003-07/txt/msg01925.txt.bz2 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