home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.29 / text0072.txt < prev    next >
Encoding:
Text File  |  1992-12-26  |  1.9 KB  |  43 lines

  1. Submitted-by: diamond@jit345.bad.jit.dec.com (Norman Diamond)
  2.  
  3. In article <1e6nslINN4rd@ftp.UU.NET> rfg@netcom.com (Ronald F. Guilmette) writes:
  4. >Certain of the functions which must be declared (preferably with prototypes)
  5. >in the <stdio.h> file (e.g. vprintf) are defined (by the ANSI C standard) to
  6. >take arguments of type `va_list'.
  7.  
  8. If a user's program declares printf instead of doing #include <stdio.h> then
  9. the user's program must include a prototype with ellipsis ", ...".
  10. If you're talking about the internals of the implementation's <stdio.h> then
  11. the implementation is allowed to encode the declarations however it likes,
  12. not necessarily encoded in the C language, not necessarily using prototypes
  13. -- the implementation can choose any method that works for itself.
  14.  
  15. >But careful implementors know that if `va_list' is declared whever <stdio.h>
  16. >is included, this will cause an small but unnecessary (and possibly illegal)
  17. >pollution of the user's namespace.
  18. >My first question is simply this.  Is the practice of avoiding definition
  19. >of a va_list type in <stdio.h> strictly required by the ANSI C standard?
  20.  
  21. Yes.  s/possibly//  And carelessness yields non-conforming implementations.
  22.  
  23. >In what other cases are such "hidden built-in type hacks" required as a result
  24. >of other requirements in the ANSI C standard (or in POSIX 1003.1-1990)?
  25.  
  26. It's probably easiest to encode hidden built-in type hacks for EVERYTHING and
  27. avoid exactly this worry (assuming that you're an implementor).
  28.  
  29. [Examples deleted:  size_t in <time.h> and time_t in <sys/stat.h>]
  30.  
  31. ANSI C section 4.12.1, page 171 line 12, says that <time.h> declares size_t.
  32. I don't have the POSIX standard.
  33.  
  34. --
  35. Norman Diamond       diamond@jit081.enet.dec.com
  36. If this were the company's opinion, I wouldn't be allowed to post it.
  37. "It's been a lovely recession."
  38.  
  39. [ Note followup-to: line, please.  Thanks -- mod ]
  40.  
  41. Volume-Number: Volume 29, Number 73
  42.  
  43.