git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org,
	Nathaniel P Dawson <nathaniel.dawson@gmail.com>,
	Johannes Sixt <j.sixt@viscovery.net>,
	Nanako Shiraishi <nanako3@lavabit.com>
Subject: Re: [PATCH] Documentation/CodingGuidelines: improve header includes rules
Date: Wed, 15 Apr 2009 03:58:19 -0400	[thread overview]
Message-ID: <20090415075819.GC23332@coredump.intra.peff.net> (raw)
In-Reply-To: <20090414003433.39cbdea2.chriscool@tuxfamily.org>

On Tue, Apr 14, 2009 at 12:34:33AM +0200, Christian Couder wrote:

> 	- The third one means that for example if we have "revision.h"
> 	that includes "diff.h" and "commit.h", then it's ok to include
> 	"revision.h" in a C file, only if at least one feature from
> 	"revision.h" is actually used in the C file.
> 
> 	It is not ok to include "revision.h" if features from "diff.h"
> 	and "commit.h" are used but no feature from "revision.h" is
> 	used.

Why? I thought the guiding principle mentioned earlier was "don't waste
programmers' time figuring out what should and shouldn't be included".

Sure, I would not expect somebody to include a header that is totally
unrelated, but it seems that most of the source files lazily include
cache.h just to get "everything".

Stripping unnecessary includes doesn't even speed up compilation, as our
Makefile overspecifies the header dependencies anyway.

-Peff

  parent reply	other threads:[~2009-04-15  8:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 22:34 [PATCH] Documentation/CodingGuidelines: improve header includes rules Christian Couder
2009-04-14 16:24 ` Johannes Schindelin
2009-04-15  7:58 ` Jeff King [this message]
2009-04-16  5:10   ` Christian Couder

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=20090415075819.GC23332@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=nanako3@lavabit.com \
    --cc=nathaniel.dawson@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).