On 3/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> On Sat Mar 25 16:57:42 EST 2006, [EMAIL PROTECTED] wrote:
> > eighty-megs and constantly swapping. and that's just the editor.
> >
> > if you look at the apple link i couldn't resist cluttering the list with,
> > you'll love some of the ways they work around the fact that gcc is slooow.
> > precompiled headers, speculative compiling (you saved a c file, we'll
> > compile it now, just in case you might need it), distcc, etc.
> >
> > that's not to mention the bizzare workarounds to their slow linker.
> >
> > - erik
>
> I find the notion of pre-compiled headers for anything other than
> a very special situation rather odd. Although the example given in
> the link is trivial it demonstrates an unthinking inefficiency we
> see all too often in practice:
>
> there's a file foo.c which has an accompanying file foo.h which
> is only ever included in foo.c
>
> This is a poor idea in many ways and is perhaps one of the reasons
> we see all these other things being necessary to make the user believe
> that things are happening faster.
>
> Recently I was poking around in a multi-file open source driver and
> came across more than one instance of the following which pulled me
> up short (names changed to protect the guilty):
>
> foo.h contains the following:
>
> #define THING { \
> { 1234, XXX_YY0, ZZZ0 }, \
> { 5678, XXX_YY1, ZZZ1 }, \
> ... 200 more of these ...
> }
>
> and is only included in foo.c which contains one instance of
> its use:
>
> static const struct
> thing thing_table[] = THING;
>
> It would never occur to me to #define a table like that. Age, I
> suppose.
>
> --jim
>
I can think of only one reason to do this. If it's a linux kernel
driver, sometimes you get distributions that have options for "kernel
headers" and "kernel source". Obviously kernel source includes the
headers, but in a lot of cases the headers are all you need. In this
case, perhaps they wanted to expose the definition of a table in the
header for people to see.
Still, I agree it's very odd to do such a thing.