home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16686 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.3 KB  |  60 lines

  1. Newsgroups: comp.lang.c
  2. 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
  3. From: root@ufps9.unifr.ch (Laurent Schmutz)
  4. Subject: Re: Multiple Parameter Passing (unspecified number)
  5. Message-ID: <1992Nov17.140352@ufps9.unifr.ch>
  6. Sender: root@ufps9.unifr.ch (Operator)
  7. Organization: University of Fribourg - CH
  8. References: <92321.124834GNR100@psuvm.psu.edu> <BxtrFG.Fq4@portal.hq.videocart.com>
  9. Date: Tue, 17 Nov 1992 13:03:52 GMT
  10. Lines: 48
  11.  
  12. In article <BxtrFG.Fq4@portal.hq.videocart.com>, dfuller@portal.hq.videocart.com (Dave Fuller) writes:
  13. |> GNR100@psuvm.psu.edu writes:
  14. |> : 
  15. |> :    Hi.
  16. |> : 
  17. |> :    I'm looking to write a function that accepts any number of paramerter.
  18. |> : There will be at least two, an int and a char[]. The rest will all be char[]'s.
  19. |> : I need to know how this is done.  The meathod would be similar to that of
  20. |> : printf(), so if anybody know how that works, please let me know.
  21. |> :                  Thanks,
  22. |> :                      Gordon Rogers
  23. |> :                      gnr100@psuvm.psu.edu
  24. |> 
  25. |> 
  26. |> Gordon,
  27. |>     Sort of depends. UNIX versions will use definitions from varargs.h and 
  28. |> non-UNIX platforms use stdarg.h (I believe these are the correct header files).
  29. |> 
  30. |> 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
  31. |> non-UNIX versions use va_end, va_arg, va_list
  32. |>                       and va_start (with 1 extra parm)
  33. |> (not all of these are macros. va_alist, va_dcl, and va_list are variables)
  34. |> 
  35. |> I haven't used varargs in a while so this may not be complete.
  36. |> 
  37. |> Sorry this is not a full-blown answer, but if it doesn't get you headed
  38. |> in the right direction, write me. As i said, i will respond with full
  39. |> functional usage of the variable argument scheme.
  40. |> 
  41. |> 
  42. |> Dave Fuller
  43. |> dfuller@portal.hq.videocart.com
  44. |> 
  45.  
  46. Perhaps something more Dave,
  47.  
  48. In the Kernighan & Ritchie's book "The ANSI-C programming language - second edition"
  49. (1988) the use is restricted to
  50.  
  51.         va_start, va_end, va_arg, va_list
  52.  
  53.         coming from <stdarg.h>
  54.  
  55. We can so suppose that a normallized ANSI-C compiler will accept these. Tell me if not.
  56. Best regards.
  57.  
  58.                             Laurent Schmutz
  59.                             schmutz@CFrUni52.bitnet
  60.