[comp.std.unix] POSIX 1003.1 and <sys/types.h>

jrstu@cbnewsd.ATT.COM (james.stuhlmacher) (12/17/89)

From: jrstu@cbnewsd.ATT.COM (james.stuhlmacher)

I was told by someone that the POSIX standard does not allow
including <sys/type.h> in any of the other include files such as
<grp.h>.  Is this true?  I could not find this anywhere in the book. 
If it is true, why is this the case? 

Thank you for any help you can provide.

Jim Stuhlmacher
j.stuhlmacher@ATT.com
..!att!ihlpb!jims

Volume-Number: Volume 17, Number 106

karish@forel.stanford.edu (Chuck Karish) (12/18/89)

From: karish@forel.stanford.edu (Chuck Karish)

In article <479@longway.TIC.COM> uunet!cbnewsd.ATT.COM!jrstu
(james.stuhlmacher,ih,) wrote:
>From: jrstu@cbnewsd.ATT.COM (james.stuhlmacher)
>
>I was told by someone that the POSIX standard does not allow
>including <sys/type.h> in any of the other include files such as
><grp.h>.  Is this true?  I could not find this anywhere in the book. 
>If it is true, why is this the case? 

Is this necessary?  A portable application that uses <grp.h> had better
#include <sys/types.h> itself anyway, so it will have type gid_t
available on an implementation that does not use the nested
#includes.

There's no specific prohibition in the standard.  However, it's a
non-trivial task to implement the headers in such a way that this is
safe.  The implementation must not surprise the programmer by
providing an unexpected typedef or function prototype that could
legally be coded directly into a program.

	Chuck Karish		karish@mindcraft.com
	(415) 323-9000		karish@forel.stanford.edu

Volume-Number: Volume 17, Number 107