From: Sandy Harris <pashley@storm.ca>
To: linux-kernel@vger.kernel.org
Subject: Re: [patch,rfc] make depencies on header files explicit
Date: Fri, 05 Jul 2002 02:20:30 -0400 [thread overview]
Message-ID: <3D253AAE.D73E1E07@storm.ca> (raw)
In-Reply-To: <20020705111257.04d026b1.sfr@canb.auug.org.au>
Stephen Rothwell wrote:
> > It seems to be quite common to assume that sched.h and all the other
> > headers it drags in are available without declaration anyways. Since
> > I aim at invalidating this assumption by removing all unneccessary
> > includes, I have started to make dependencies on header files included
> > by sched.h explicit.
> > This is, again, just a small start, a patch covering the whole include/
> > subtree would be approximately 25 times as large. However, before I'll
> > dig into this further, I'd like to make sure I haven't missed some
> > implicit rules about which headers might be assumed available, or should
> > be included by the importing .c file, or something like that.
> > So any comments about this project are welcome.
>
> Let me encourage you! IMHO any source file (and here I include header
> files) should include all the header files it depends on. This gives us
> at least some chance of keeping the headers consistant with their usage.
I thought conventional wisdom was that header files should never #include
other headers, and .c files should explicitly #include all headers they
need.
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
Am I just off base in relation to kernel coding style? Or would getting
rid of header file nesting be a useful objective.
next prev parent reply other threads:[~2002-07-05 7:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-03 21:45 Tim Schmielau
2002-07-05 1:12 ` Stephen Rothwell
2002-07-05 6:20 ` Sandy Harris [this message]
2002-07-05 7:58 ` Stephen Rothwell
2002-07-06 0:39 ` Tim Schmielau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D253AAE.D73E1E07@storm.ca \
--to=pashley@storm.ca \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®