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

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!decuac!pa.dec.com!jrdzzz.jrd.dec.com!jit345.bad.jit.dec.com!diamond
  3. From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
  4. Subject: Re: A different question about va_start & va_end.
  5. Message-ID: <BxAL1r.J3r@jrd.dec.com>
  6. Sender: usenet@jrd.dec.com (USENET News System)
  7. Nntp-Posting-Host: jit345
  8. Reply-To: diamond@jit.dec.com (Norman Diamond)
  9. Organization: Digital Equipment Corporation Japan , Tokyo
  10. References: <1992Nov6.014500.1353@netcom.com>
  11. Date: Fri, 6 Nov 1992 11:25:03 GMT
  12. Lines: 32
  13.  
  14. In article <1992Nov6.014500.1353@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
  15. >Must a standard conforming implementation accept:
  16.  
  17. s/standard conforming implementation/conforming implementation/
  18.  
  19. >    #include <stdarg.h>
  20. >    int i, j;
  21. >    va_list ap;
  22. >    void foo (int bar, ...) {
  23. >        i = (va_start (ap, bar), 99);
  24. >        j = (va_end (ap), 88);
  25. >    }
  26. >In other words, may a programmer safely assume that invocations (or
  27. >expansions) of va_start and va_end are themselves expressions?
  28. >The function declarations shown in 4.8.1.1 and 4.8.1.2 seem to suggest
  29. >that the answer is yes.
  30.  
  31. 4.8.1, page 123 lines 17 to 19, says that va_start and va_arg must
  32. be macros, while va_end may be either macro or identifier.  However,
  33. if we interpret the function declarations as specifying usage syntax,
  34. then I would say that they must be expressions, as you say.
  35.  
  36. The va_list ap; declaration must be moved inside the function.
  37. 4.8, page 123 lines 11 to 12.  Ah wait a minute.  The function has to
  38. have this declaration, not necessarily a definition.  So you can keep
  39. the file scope one (with external linkage at that) and just copy it
  40. into the function as well.  I wonder if this is a bug (different rule
  41. from what was intended) in the standard.
  42. --
  43. Norman Diamond       diamond@jit081.enet.dec.com
  44. If this were the company's opinion, I wouldn't be allowed to post it.
  45. "It's been a lovely recession."
  46.