Article View: comp.std.unix
Article #855Re: Header files and "hidden built-in type hacks".
From: Norman Diamond
Date: Wed, 18 Nov 1992 06:20
Date: Wed, 18 Nov 1992 06:20
41 lines
2546 bytes
2546 bytes
Submitted-by: diamond@jit345.bad.jit.dec.com (Norman Diamond) In article <1e6nslINN4rd@ftp.UU.NET> rfg@netcom.com (Ronald F. Guilmette) writes: >Certain of the functions which must be declared (preferably with prototypes) >in the <stdio.h> file (e.g. vprintf) are defined (by the ANSI C standard) to >take arguments of type `va_list'. If a user's program declares printf instead of doing #include <stdio.h> then the user's program must include a prototype with ellipsis ", ...". If you're talking about the internals of the implementation's <stdio.h> then the implementation is allowed to encode the declarations however it likes, not necessarily encoded in the C language, not necessarily using prototypes -- the implementation can choose any method that works for itself. >But careful implementors know that if `va_list' is declared whever <stdio.h> >is included, this will cause an small but unnecessary (and possibly illegal) >pollution of the user's namespace. >My first question is simply this. Is the practice of avoiding definition >of a va_list type in <stdio.h> strictly required by the ANSI C standard? Yes. s/possibly// And carelessness yields non-conforming implementations. >In what other cases are such "hidden built-in type hacks" required as a result >of other requirements in the ANSI C standard (or in POSIX 1003.1-1990)? It's probably easiest to encode hidden built-in type hacks for EVERYTHING and avoid exactly this worry (assuming that you're an implementor). [Examples deleted: size_t in <time.h> and time_t in <sys/stat.h>] ANSI C section 4.12.1, page 171 line 12, says that <time.h> declares size_t. I don't have the POSIX standard. -- Norman Diamond diamond@jit081.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it. "It's been a lovely recession." [ Note followup-to: line, please. Thanks -- mod ] Volume-Number: Volume 29, Number 73
Technical Details
Message-ID:
<1ecnbkINNpag@ftp.UU.NET>Path:
arc1-ca.pugleaf.net!sparky!uunet!not-for-mailReferences:
<1e6nslINN4rd@ftp.UU.NET>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!not-for-mail From: diamond@jit345.bad.jit.dec.com (Norman Diamond) Newsgroups: comp.std.unix,comp.std.c Subject: Re: Header files and "hidden built-in type hacks". Followup-To: comp.std.c Date: 17 Nov 1992 22:20:36 -0800 Organization: Digital Equipment Corporation Japan , Tokyo Lines: 41 Sender: sef@ftp.UU.NET Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan) Message-ID: <1ecnbkINNpag@ftp.UU.NET> References: <1e6nslINN4rd@ftp.UU.NET> Reply-To: diamond@jit.dec.com (Norman Diamond) NNTP-Posting-Host: ftp.uu.net X-Submissions: std-unix@uunet.uu.net