Subject: Re: multiple inclusion protection for kernel files
To: Garrett D'Amore <firstname.lastname@example.org>
From: David Laight <email@example.com>
Date: 12/04/2005 19:54:14
On Sat, Dec 03, 2005 at 07:01:09PM -0800, Garrett D'Amore wrote:
> For the same reason that multiple inclusion is a problem for userland,
> it can be a problem for kernel space files. I think the include guards
> should be on any file, unless we create an "arbitrary" rule that says
> that kernel headers cannot include other kernel headers.
Especially since (IIRC) that having the include guards is a zero cost
test when it comes to multiple inclusion since many C compilers will
remember that the entire file was covered by a single #if and have
cached the comparison against the filename.
So the second include shouldn't even involve finding the file.
David Laight: firstname.lastname@example.org