[Rd] Summary: too many arguments in foreign function call

John Chambers jmc@research.bell-labs.com
Wed, 18 Jul 2001 15:00:56 -0400


Peter Dalgaard BSA wrote:
> 
> "Warnes, Gregory R" <gregory_r_warnes@groton.pfizer.com> writes:
> 
> > 6) I still feel that it is a reasonable change to increase the number of
> > permitted arguments, at least to the same limits (whatever they are) imposed
> > by S-Plus.  This seems simpler than telling users that as soon as they hit
> > 65 arguments they have to change their code or learn a new interface
> > mechanism.
> 
> I think you missed one point that John was making: "N++". There has to
> be a limit to the number of arguments, C does not allow you to code
> anything else portably. Whatever limit we choose, someone is going to
> bump into it sooner or later, and we can't just increase the limit
> every time.
> 
> Then there's the problem of portability between compilers. A little
> Web search reveals that the minimum maximum number (sic) of arguments
> that a C compiler may impose according to the C standard is 31. So
> there may already be standards-compliant C compilers that cannot
> compile R. Obviously none of those have appeared within our user
> base...
> 
> That being said, I think 65 is a pretty weird limit to have. 2^N-1
> would be a more obvious guess at a potential hard limit. So, since
> we're already past 63, how about having a quick round of testing among
> the R-devel readers to check out whether any of their systems would
> break from inserting a limit of 127 or 255?
> 
> --
>    O__  ---- Peter Dalgaard             Blegdamsvej 3
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

Empirical evidence is that the limit in S-Plus is 128.  (The call
manyArgs(N) constructs a .C with N arguments to a C routine (with 200
arguments)).

Splus6
S-PLUS : Copyright (c) 1988, 2000 MathSoft, Inc.
S : Copyright Lucent Technologies, Inc.
Version 6.0 Release 1 for Linux 2.2.12 : 2000 
Working data will be in .Data 
> manyArgs(128)
[1] T

Splus6
S-PLUS : Copyright (c) 1988, 2000 MathSoft, Inc.
S : Copyright Lucent Technologies, Inc.
Version 6.0 Release 1 for Linux 2.2.12 : 2000 
Working data will be in .Data 
> manyArgs(129)
Problem in .C("many_args",: Sorry, no more than 128 arguments allowed in
dynamic call, while calling subroutine many_args 

-- 
John M. Chambers                  jmc@bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._