This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Projects for beginners
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: Re: Projects for beginners
- From: Daniel Berlin <dberlin at redhat dot com>
- Date: Wed, 31 Jan 2001 18:59:20 -0500 (EST)
- cc: <bkorb at cruzio dot com>, <gcc at gcc dot gnu dot org>
On Wed, 31 Jan 2001, Richard Kenner wrote:
> NO!!! I remember well the days of unguarded headers. They are not
> completely dead yet, but I still hope for their final demise. I do
> not ever want to _have_ to know that header a can be included only
> after header b. Programming is complicated enough without just that
> much more clutter. NO, NO and NO AGAIN!
>
> If the structure of the headers is so complicated, it needs to be
> simplified.
He said programming is complicated, not headers.
He said that headers without guards cause clutter.
> The perceived need to put in "guards" is merely a symptom
> that things have gotten too complicated. They should be made simpler,
> not patched over by adding the clutter of guards.
>
Um, no it's not.
It's a symptom of thinking that the programmer should have to know all of
the headers and what they do to do *anything* with a header that might
have nothing to do with them.
I wasted at least 20 minutes trying to figure out what stupid headers I
had to include to be able to include the sbitmap stuff, the hard register
set stuff, etc.
This is because they are all unguarded, and just don't include what they
need as a result.
I ended up just copying the list of includes from some other file, and
inccluding what i needed after that.
This is the problem that header guards solves. The need for me to know
that i have to include
#include "config.h"
#include "system.h"
#include "rtl.h"
before i can
#include "sbitmap.h"
and i have to include a few others before i can include basic-block.h
This is pretty dumb. If they had header guards, they could just include
the files they needed, and i could just include the files I needed.
--Dan