home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / std / unix / 463 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  2.5 KB

  1. Xref: sparky comp.std.unix:463 comp.std.c:3023
  2. Path: sparky!uunet!not-for-mail
  3. From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
  4. Newsgroups: comp.std.unix,comp.std.c
  5. Subject: Re: Header files and "hidden built-in type hacks".
  6. Followup-To: comp.std.c
  7. Date: 17 Nov 1992 22:20:36 -0800
  8. Organization: Digital Equipment Corporation Japan , Tokyo
  9. Lines: 41
  10. Sender: sef@ftp.UU.NET
  11. Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
  12. Message-ID: <1ecnbkINNpag@ftp.UU.NET>
  13. References: <1e6nslINN4rd@ftp.UU.NET>
  14. Reply-To: diamond@jit.dec.com (Norman Diamond)
  15. NNTP-Posting-Host: ftp.uu.net
  16. X-Submissions: std-unix@uunet.uu.net
  17.  
  18. Submitted-by: diamond@jit345.bad.jit.dec.com (Norman Diamond)
  19.  
  20. In article <1e6nslINN4rd@ftp.UU.NET> rfg@netcom.com (Ronald F. Guilmette) writes:
  21. >Certain of the functions which must be declared (preferably with prototypes)
  22. >in the <stdio.h> file (e.g. vprintf) are defined (by the ANSI C standard) to
  23. >take arguments of type `va_list'.
  24.  
  25. If a user's program declares printf instead of doing #include <stdio.h> then
  26. the user's program must include a prototype with ellipsis ", ...".
  27. If you're talking about the internals of the implementation's <stdio.h> then
  28. the implementation is allowed to encode the declarations however it likes,
  29. not necessarily encoded in the C language, not necessarily using prototypes
  30. -- the implementation can choose any method that works for itself.
  31.  
  32. >But careful implementors know that if `va_list' is declared whever <stdio.h>
  33. >is included, this will cause an small but unnecessary (and possibly illegal)
  34. >pollution of the user's namespace.
  35. >My first question is simply this.  Is the practice of avoiding definition
  36. >of a va_list type in <stdio.h> strictly required by the ANSI C standard?
  37.  
  38. Yes.  s/possibly//  And carelessness yields non-conforming implementations.
  39.  
  40. >In what other cases are such "hidden built-in type hacks" required as a result
  41. >of other requirements in the ANSI C standard (or in POSIX 1003.1-1990)?
  42.  
  43. It's probably easiest to encode hidden built-in type hacks for EVERYTHING and
  44. avoid exactly this worry (assuming that you're an implementor).
  45.  
  46. [Examples deleted:  size_t in <time.h> and time_t in <sys/stat.h>]
  47.  
  48. ANSI C section 4.12.1, page 171 line 12, says that <time.h> declares size_t.
  49. I don't have the POSIX standard.
  50.  
  51. --
  52. Norman Diamond       diamond@jit081.enet.dec.com
  53. If this were the company's opinion, I wouldn't be allowed to post it.
  54. "It's been a lovely recession."
  55.  
  56. [ Note followup-to: line, please.  Thanks -- mod ]
  57.  
  58. Volume-Number: Volume 29, Number 73
  59.