Subject: Re: includes question
To: None <tech-kern@NetBSD.ORG>
From: Luke Mewburn <lukem@netbsd.org>
List: tech-kern
Date: 11/12/2002 12:15:08
On Tue, Nov 12, 2002 at 12:10:06PM +1100, Luke Mewburn wrote:
  | On the other hand, if the interface definition says you must include
  | <sys/socket.h> and makes *no mention* of <sys/types.h>, then you
  | shouldn't be required to pull in <sys/types.h> first.
  | 
  | This is a situation that occurs right now with bind(2) (et al); code
  | written on other systems to the manual pages (including the NetBSD
  | manual pages!) and to the POSIX standards which only include
  | <sys/socket.h> will not compile on NetBSD unless <sys/types.h> is
  | pulled in first.
  | 
  | This is wrong, and our header files should be fixed to match the
  | standards and our manual pages.

Doh; I should test this again before posting.  I was sure that I had a
situation recently that required <sys/types.h> before <sys/socket.h>
to use bind(2) and connect(2), but a test program I just wrote doesn't
suffer from this.  Well, ignore this example.

My point still stands though; if the standards (and our manuals) say
"include foo" but make no mention of bar, and foo needs bar, then foo
should pull in bar.