Date: Tue, 9 Aug 2005 23:34:49 +0100 (BST) From: Robert Watson <rwatson@FreeBSD.org> To: Dirk GOUDERS <gouders@et.bocholt.fh-ge.de> Cc: hackers@freebsd.org Subject: Re: Include files that depend on include files Message-ID: <20050809233345.K1195@fledge.watson.org> In-Reply-To: <200508092222.j79MM1DR013799@sora.hank.home> References: <200508092222.j79MM1DR013799@sora.hank.home>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050809233345.K1195>