Re: [patch,rfc] make depencies on header files explicit

From: Stephen Rothwell (sfr@canb.auug.org.au)
Date: Fri Jul 05 2002 - 02:58:37 EST


Hi Sandy,

On Fri, 05 Jul 2002 02:20:30 -0400 Sandy Harris <pashley@storm.ca> wrote:
>
> I thought conventional wisdom was that header files should never #include
> other headers, and .c files should explicitly #include all headers they
> need.

Conventional wisdom varies depending on whose conventions you are asking :-)

> Googling on "nested header" turns up several style guides that agree:
> http://www.cs.mcgill.ca/resourcepages/indian-hill.html
> http://www.doc.ic.ac.uk/lab/secondyear/cstyle/node5.html
>
> and others that say it is controversial, can be done either way:
> http://www.eskimo.com/~scs/C-faq/q10.7.html

Yes, well I know it is controversial ...

> Am I just off base in relation to kernel coding style? Or would getting
> rid of header file nesting be a useful objective.

The CodingStyle file is silent on this.

I just find it a real pain sometimes trying to figure out what other
include files I need to when all I really want is one or two definitions
in one particular include file. The same holds true when I am removing
or moving stuff from one place to another (especially when trying to
clean up some of the current mess).

Given that all kernel header files protect themselves from being included
multiple times, I think locality wins us something.

As I said, this is (just) my (humble) opinion. :-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 07 2002 - 22:00:14 EST