Path: utzoo!attcan!uunet!lll-winken!ames!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: passing variable numbers of arguments Message-ID: <15347@mimsy.UUCP> Date: 9 Jan 89 01:24:56 GMT References: <899@thor.stolaf.edu> <15341@mimsy.UUCP> <449@marob.MASA.COM> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 28 In article <449@marob.MASA.COM> samperi@marob.MASA.COM (Dominick Samperi) writes: >It seems that for the ANSI style varargs (that is, the one requiring >stdarg.h), at least one explicitly named arg must be included in the >function definition [to provide an `anchor' for va_start] .... Correct. >... how does one define a function with a variable number of args, >for which there are no explicitly named args? I find it rather annoying that this is not possible. A routine like `make-vector', which takes a variable number of pointers and makes a vector of pointers (with the last signified by a NULL pointer of the appropriate type) must be written awkwardly instead of in the simple fashion possible with . >Wouldn't it have been reasonable for the standard to specify that the >compiler should enable the called function to determine the number of >parameters that were passed ... ? Possibly. But that is not enough information: one needs not only the number of parameters, but also their types. It seems to me that doing half the job (providing the count without the types) would be worse than doing nothing at all. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris