home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!caen!batcomputer!ghost.dsi.unimi.it!univ-lyon1.fr!chx400!unifr_news!ufps9.unifr.ch!root
- From: root@ufps9.unifr.ch (Laurent Schmutz)
- Subject: Re: Multiple Parameter Passing (unspecified number)
- Message-ID: <1992Nov17.140352@ufps9.unifr.ch>
- Sender: root@ufps9.unifr.ch (Operator)
- Organization: University of Fribourg - CH
- References: <92321.124834GNR100@psuvm.psu.edu> <BxtrFG.Fq4@portal.hq.videocart.com>
- Date: Tue, 17 Nov 1992 13:03:52 GMT
- Lines: 48
-
- In article <BxtrFG.Fq4@portal.hq.videocart.com>, dfuller@portal.hq.videocart.com (Dave Fuller) writes:
- |> GNR100@psuvm.psu.edu writes:
- |> :
- |> : Hi.
- |> :
- |> : I'm looking to write a function that accepts any number of paramerter.
- |> : There will be at least two, an int and a char[]. The rest will all be char[]'s.
- |> : I need to know how this is done. The meathod would be similar to that of
- |> : printf(), so if anybody know how that works, please let me know.
- |> : Thanks,
- |> : Gordon Rogers
- |> : gnr100@psuvm.psu.edu
- |>
- |>
- |> Gordon,
- |> Sort of depends. UNIX versions will use definitions from varargs.h and
- |> non-UNIX platforms use stdarg.h (I believe these are the correct header files).
- |>
- |> UNIX versions use va_dcl, va_start, va_end, va_arg, va_list,va_start, va_end, va_arg, va_list,va_start, va_end, va_arg, va_list, and va_alist
- |> non-UNIX versions use va_end, va_arg, va_list
- |> and va_start (with 1 extra parm)
- |> (not all of these are macros. va_alist, va_dcl, and va_list are variables)
- |>
- |> I haven't used varargs in a while so this may not be complete.
- |>
- |> Sorry this is not a full-blown answer, but if it doesn't get you headed
- |> in the right direction, write me. As i said, i will respond with full
- |> functional usage of the variable argument scheme.
- |>
- |>
- |> Dave Fuller
- |> dfuller@portal.hq.videocart.com
- |>
-
- Perhaps something more Dave,
-
- In the Kernighan & Ritchie's book "The ANSI-C programming language - second edition"
- (1988) the use is restricted to
-
- va_start, va_end, va_arg, va_list
-
- coming from <stdarg.h>
-
- We can so suppose that a normallized ANSI-C compiler will accept these. Tell me if not.
- Best regards.
-
- Laurent Schmutz
- schmutz@CFrUni52.bitnet
-