Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!sgi!shinobu!odin!flobb4!micah From: micah@flobb4.csd.sgi.com (Micah Altman) Newsgroups: comp.sys.sgi Subject: Re: varargs and -prototype Keywords: varargs, ANSI, prototype Message-ID: <1991May10.172449.26884@odin.corp.sgi.com> Date: 10 May 91 17:24:49 GMT References: Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc. Mountain View, CA Lines: 32 In srp@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@csd.sgi.com Phone (415) 335-1866 FAX (415) 965-2309 Disclaimer: Everything in this document is a lie.