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

  1. Xref: sparky comp.std.unix:462 comp.std.c:3022
  2. Path: sparky!uunet!not-for-mail
  3. From: steve@taumet.com (Steve Clamage)
  4. Newsgroups: comp.std.unix,comp.std.c
  5. Subject: Re: Header files and "hidden built-in type hacks".
  6. Date: 17 Nov 1992 22:16:56 -0800
  7. Organization: TauMetric Corporation
  8. Lines: 34
  9. Sender: sef@ftp.UU.NET
  10. Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
  11. Message-ID: <1ecn4oINNp6a@ftp.UU.NET>
  12. References: <1e6nslINN4rd@ftp.UU.NET>
  13. NNTP-Posting-Host: ftp.uu.net
  14. X-Submissions: std-unix@uunet.uu.net
  15.  
  16. Submitted-by: steve@taumet.com (Steve Clamage)
  17.  
  18. rfg@netcom.com (Ronald F. Guilmette) writes:
  19. >My first question is simply this.  Is the practice of avoiding definition
  20. >of a va_list type in <stdio.h> strictly required by the ANSI C standard?
  21. >My (naive?) believe is that this practice *is* required in order to avoid
  22. >non-standard pollution of the user's namespace.
  23.  
  24. ANSI section 4.1.2.1 in conjunction with 4.8 and 4.9 makes it very clear
  25. that <stdio.h> cannot define the identifier "va_list".  It is legal for
  26. a user program to include <stdio.h> without including <stdarg.h>.  If
  27. <stdarg.h> is not included, the identifier va_list is not reserved.
  28. Hence hacks like __va_list which are a conforming way around the problem.
  29.  
  30. >My second question is also a simple one.  In what other cases are such
  31. >"hidden built-in type hacks" required as a result of other requirements
  32. >in the ANSI C standard (or in POSIX 1003.1-1990)?
  33.  
  34. I can't speak to the POSIX question.  Any identifier which is not
  35. reserved according to 4.1.2.1 and which is implicitly referenced but
  36. not defined by a Standard C header must have some sort of work-around.
  37. (Only those identifiers not otherwise reserved may be defined in a
  38. conforming Standard C header.)
  39.  
  40. Some types, like size_t, must be defined in more than one header.
  41. This means that some workaround is needed for these types as well
  42. to avoid multiple definitions.
  43. -- 
  44.  
  45. Steve Clamage, TauMetric Corp, steve@taumet.com
  46. Vice Chair, ANSI C++ Committee, X3J16
  47.  
  48.  
  49. Volume-Number: Volume 29, Number 72
  50.