git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/5] Header includes cleanup

From
Christian Couder <chriscool@tuxfamily.org>
Date
Apr 3, 2009, 04:14 UTC
Message-ID
<200904030614.26310.chriscool@tuxfamily.org>
In-Reply-To
<20090402112705.GD14599@sigill.intra.peff.net>
Hi,
Le jeudi 2 avril 2009, Jeff King a écrit :
Show 19 quoted lines
> On Wed, Apr 01, 2009 at 10:25:09PM -0700, Junio C Hamano wrote:
> > > - a header file should be included in a C file only if it is needed
> > > to compile the C file (it is not ok to include it only because it
> > > includes many other headers that are needed)
> >
> > If that is the rule, perhaps the problem lies not in a .c program that
> > includes such a .h header, but in the .h itself that includes many
> > other header files.
>
> If this were combined with splitting gigantic .h files (like cache.h)
> into smaller logical units, then we could in theory speed up
> recompilation times with make (we would also need to correctly track
> header dependencies, but gcc -M can do this fairly easily).
>
> But it does come at the price of actually having to consider which
> include files are necessary. I can't think of more than half a dozen
> times in the last year I have actually had to add a #include while
> working on a git .c file, mostly because everything and the kitchen sink
> is included by cache.h.

Yeah, I think the best feature of the actual design is the simplicity, and that's why we don't have to add new #include very often. So let's keep this simplicity by having and applying rules to keep things simple for the developer.

> So I don't know if it is worth it.

I am not sure what you are talking about here, but if you mean that you don't think it's worth splitting gigantic .h files (like cache.h) into smaller logical units, then I agree.

Best regards, Christian.

Previous: Jeff KingNext: Jeff King
Message 14 of 17 in “Header includes cleanup”
  1. 0/5 Header includes cleanupNathaniel P Dawson, Mar 30, 2009
  2. 1/5 Header includes cleanupNathaniel P Dawson, Mar 30, 2009
  3. 2/5 Header includes cleanupNathaniel P Dawson, Mar 30, 2009
  4. 3/5 Header includes cleanupNathaniel P Dawson, Mar 30, 2009
  5. 4/5 Header includes cleanupNathaniel P Dawson, Mar 30, 2009
  6. 5/5 Header includes cleanupNathaniel P Dawson, Mar 30, 2009
  7. Johannes SixtMar 30, 2009
  8. Nathaniel P DawsonMar 30, 2009
  9. Christian CouderMar 31, 2009
  10. Junio C HamanoMar 31, 2009
  11. Christian CouderApr 2, 2009
  12. Junio C HamanoApr 2, 2009
  13. Jeff KingApr 2, 2009
  14. Christian CouderApr 3, 2009
  15. Jeff KingApr 3, 2009
  16. Christian CouderApr 3, 2009
  17. Christian CouderMar 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.