From owner-freebsd-hackers Tue May 7 9:37:48 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from gull.prod.itd.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by hub.freebsd.org (Postfix) with ESMTP id 0D1B637B40B for ; Tue, 7 May 2002 09:37:43 -0700 (PDT) Received: from pool0147.cvx22-bradley.dialup.earthlink.net ([209.179.198.147] helo=mindspring.com) by gull.prod.itd.earthlink.net with esmtp (Exim 3.33 #2) id 1757y0-0006or-00; Tue, 07 May 2002 09:37:33 -0700 Message-ID: <3CD802AF.45825A2C@mindspring.com> Date: Tue, 07 May 2002 09:37:03 -0700 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: aaron Cc: freebsd-hackers@freebsd.org Subject: Re: /usr/include/netinet/in.h References: <200205071814.46995.aaron@lo-res.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG aaron wrote: > I am just trying to write a simple IPv6 socket app. > after #including I noticed that I have to include > BEFORE which struck me as rather strange... > > Should not .h files include the depending .h files themselves so that all > dependencies of type / struct / #define definitions are met automatically? Such an arrangement is called "promiscuous includes". The problems with doing this are many, but the main ones are: o Including a file to get something expected into the namespace drags unexpected things into the namespace (perhaps a lot of them). o Compilation times go up geometrically o The programmer is shielded from explicit knowledge of the included files; this is bad, since it's the programmer's job to know these things o The resulting code is not portable to all platforms o Header files that do this are not technically standards compliant, since the standards dictate which header files are needed to access which functions in the API. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message