varargs and -prototype
Micah Altman
micah at flobb4.csd.sgi.com
Sat May 11 03:24:49 AEST 1991
In <srp.673809276 at babar.mmwb.ucsf.edu> srp at babar.mmwb.ucsf.edu (Scott R. Presnell) writes:
> I am working on a program that uses varargs. At the same time, but
>for other reasons, I would like to use the IRIX -prototypes argument to
>cc(1). Is there a "correct" way to specify a prototype for a function that
>uses varargs (and have it work with -prototypes)? So far, I am having
For variable argument length argument lists in ANSI, you should be
using the stdarg package, not the varargs package. The prototype form for a
variable length list is to use an ellipsis "..." after the first argument:
type function-name(first_arg_type,...)
The first argument type is mandatory, I think.
So for example, the declaration for printf would be:
int printf(char* fmt,...);
For more information, check the man page on stdarg(5) and look in the
Ansi C version of the Kernighan and Ritchie book, "The C Programming
Language"
--
"Entia non sunt multiplicanda sine necessitate." - William of Ockham
Micah Altman, "Computational Juggler" micah at csd.sgi.com
Phone (415) 335-1866 FAX (415) 965-2309
Disclaimer: Everything in this document is a lie.
More information about the Comp.sys.sgi
mailing list