🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2959

Re: Header files and "hidden built-in type hacks".

#2959
From: Norman Diamond
Date: Tue, 17 Nov 1992 00:45
41 lines
2668 bytes
If anyone sees this article twice, please e-mail diamond@jit081.enet.dec.com.
I removed it from comp.std.unix this time in hopes of seeing it get posted.

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.

>Volume-Number: Volume 29, Number 70

Is this an index to your encyclopedia of bugs in the ANSI C 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."
Technical Details
Message-ID: <1992Nov17.004538.11235@nntpd.lkg.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!decuac!pa.dec.com!datum.nyo.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
References: <1e6nslINN4rd@ftp.UU.NET>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!decuac!pa.dec.com!datum.nyo.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
Subject: Re: Header files and "hidden built-in type hacks".
Message-ID: <1992Nov17.004538.11235@nntpd.lkg.dec.com>
Sender: usenet@nntpd.lkg.dec.com (USENET News System)
Reply-To: diamond@jit.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
References: <1e6nslINN4rd@ftp.UU.NET>
Date: Tue, 17 Nov 1992 00:45:38 GMT
Lines: 41