From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 10 00:38:12 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5908716A42A for ; Wed, 10 Aug 2005 00:38:12 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 48F3F44160 for ; Tue, 9 Aug 2005 22:31:32 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id D2D6D46B2C; Tue, 9 Aug 2005 18:31:31 -0400 (EDT) Date: Tue, 9 Aug 2005 23:34:49 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Dirk GOUDERS In-Reply-To: <200508092222.j79MM1DR013799@sora.hank.home> Message-ID: <20050809233345.K1195@fledge.watson.org> References: <200508092222.j79MM1DR013799@sora.hank.home> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: hackers@freebsd.org Subject: Re: Include files that depend on include files X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2005 00:38:13 -0000 On Wed, 10 Aug 2005, Dirk GOUDERS wrote: > > This is intentational. We try to avoid having headers bring in more > > then absolutly required when included. I'm not sure what your second > > question means. > > With my second question I wanted to ask if this intention is only for > kernel level code or a general one. I am asking this, because somewhen > in a project that I was not actually participating in I heard or read a > rule that roughly said: "all include files have to include all files > they depend on and compile cleanly", but that project was on a user > space program. In general, in the role the operating system vendor, it's important to minimize "header pollution" as much as possible. Unlike C++, C doesn't have a notion of structured use of the name space, and if things are massively nested included, that dramatically increases the chance of a conflict of use between "the system" and a user application. You'll notice that increasingly, FreeBSD-specific defines are prefixed with '_', as that indicates use of reserved "you're the system" symbol space. For example, the "#ifdef KERNEL"'s all over the place became "#ifdef _KERNEL", as there's no reason an application shouldn't use a define named KERNEL. The rules are a bit different if you're the application, although it's in your interest to include as a few unnecessary headers as possible, to reduce the chances of getting definitions that conflict with your application. Robert N M Watson