Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!uunet.UU.NET!sef From: decot@hpcupt1.cup.hp.com (Dave Decot) Newsgroups: comp.std.unix Subject: Re: Must POSIX 1003.1 include files be standalone? Message-ID: <1991May17.011208.6853@uunet.uu.net> Date: 15 May 91 22:19:14 GMT References: <1991May12.181445.4553@uunet.uu.net> Sender: usenet@uunet.uu.net (UseNet News) Organization: Hewlett Packard, Cupertino Lines: 49 Approved: sef@uunet.uu.net (Moderator, Sean Eric Fagan - comp.std.unix) Originator: sef@uunet.UU.NET Nntp-Posting-Host: uunet.uu.net X-Submissions: std-unix@uunet.uu.net Submitted-by: decot@hpcupt1.cup.hp.com (Dave Decot) > Recently while working on the command sources of Andy Tanenbaums Minix 1.6 > (currently in beta and trying to become fully P1003.1 and .2 compatible), > there appeared the question whether code like > > #include > > int main (void) > { > } > > is required to work in a strictly conforming POSIX.1 implementation with > Standard C Bindings. No. But it is allowed to work. Note that POSIX.1 permits any symbols ending in _t, including uid_t, to appear in any of its headers (i.e., those not imported from ANSI C). > The problem is as follows: > > contains a prototype for struct passwd *getpwuid (uid_t) > and doesn't include by itself. I'm not shure if the > above program needs to #include itself or is > wrong. From P1003.1-1988 needs to be included only if > the program uses getpwuid(). To conform to POSIX.1-1988 or POSIX.1-1990, the program has to include first. > The same problem occurs in several other headers: e.g. , , > , . Same applies to them. > Does P1003.1-1990 specify the correct behaviour? It is clearer in this regard, although POSIX.1-1988 also required that the prerequisite #includes be there as well. POSIX.1-1991 will *require* that implementations provide stand-alone headers. In addition, a program will need to include *at most* one header in order to use a particular function (the one that contains the prototype for the function). Dave Decot Volume-Number: Volume 23, Number 73