home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / std / c / 2994 < prev    next >
Encoding:
Text File  |  1992-11-08  |  2.5 KB  |  51 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!sserve!ccadfa.cc.adfa.oz.au!cjsv
  3. From: Christopher.Vance@adfa.oz.au (Christopher JS Vance)
  4. Subject: Re: A different question about va_start & va_end.
  5. Message-ID: <1992Nov9.003430.15085@sserve.cc.adfa.oz.au>
  6. Originator: cjsv@ccadfa.cc.adfa.oz.au
  7. Sender: news@sserve.cc.adfa.oz.au
  8. Organization: Computer Science, University College, UNSW/ADFA, Canberra, Australia
  9. References: <1992Nov6.014500.1353@netcom.com> <BxAL1r.J3r@jrd.dec.com>
  10. Date: Mon, 9 Nov 1992 00:34:30 GMT
  11. Lines: 38
  12.  
  13. In article <BxAL1r.J3r@jrd.dec.com> diamond@jit.dec.com (Norman Diamond) writes:
  14. | In article <1992Nov6.014500.1353@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
  15. | >In other words, may a programmer safely assume that invocations (or
  16. | >expansions) of va_start and va_end are themselves expressions?
  17. | >The function declarations shown in 4.8.1.1 and 4.8.1.2 seem to suggest
  18. | >that the answer is yes.
  19. | 4.8.1, page 123 lines 17 to 19, says that va_start and va_arg must
  20. | be macros, while va_end may be either macro or identifier.  However,
  21. | if we interpret the function declarations as specifying usage syntax,
  22. | then I would say that they must be expressions, as you say.
  23. | The va_list ap; declaration must be moved inside the function.
  24. | 4.8, page 123 lines 11 to 12.  Ah wait a minute.  The function has to
  25. | have this declaration, not necessarily a definition.  So you can keep
  26. | the file scope one (with external linkage at that) and just copy it
  27. | into the function as well.  I wonder if this is a bug (different rule
  28. | from what was intended) in the standard.
  29.  
  30. Past practice on a Pyramid in the (partially) related varargs.h was
  31. that va_end was simply a closing brace, while va_start was some gnarly
  32. stuff with an extra opening brace.  I guess they relied on people
  33. putting va_start and va_end in the right places, matching them
  34. appropriately, and always requiring the va_end, which some lazy people
  35. leave out on many architectures.  Pyramid have changed this now.
  36.  
  37. I certainly would never expect to use va_start and va_end other than
  38. as equivalents of statements, unless I knew chapter and verse of the
  39. standard which said explicitly that it was okay to treat them as
  40. expressions.  Even then, not until all my obsolete machines go away...
  41.  
  42. Since Pyramid will apparently never ship a stdarg.h for the machine
  43. I'm using, despite shipping a compiler which groks (some?) prototypes,
  44. I'll never know.
  45.  
  46. -- Christopher
  47.  
  48. Disclaimer: I can't even afford a copy of the standard.  Either one.
  49.