Re: A programming style question

From: David Luyer <luyer@dont-contact.us>
Date: Thu, 13 Jan 2000 11:38:25 +1100

> On Thu, 13 Jan 2000, David Luyer wrote:
>
> > There is another advantage you didn't realise, or maybe did. Since squid is
> > left compiled with debugging, the executable size is massively reduced by the
> > single squid.h. gcc will basically share the debugging info if include files
> > are included in the same order, but if they aren't then it won't, since some
> > #defines etc being different due to the different order of the include files
> > may have influenced the included files.
> >
> > For discussions on this see the wine-devel list archive, probably 6-12 months
> > ago.
>
> Will the executable size be further reduced be merging all *.c
> and *.h files together?

In the WINE case, there were people arguing for it (including me at one point
I think). The justification was a truly massive compile time speedup for WINE
and executable size reduction, someone produced a patch to merge everything
together and compile it and the results were really fast but the concept is
really ugly.

In the squid case, there probably wouldn't be any reduction in executable
size, but the easy way to answer that is to just try. Compile time would
obviously be reduced by only parsing the headers once, but squid doesn't
suffer from the massive compile times of WINE to start with.

You end up with a makefile that in each directory does something like
  cat $(CFILES) > squid-selected-code.c
or
  for file in $CFILES
  do
    echo '#include "'$file'"' > squid-selected-code.c
  done

David.

-- 
David Luyer                           . .           www.zipworld.net
Network Engineer                    .  zipworld         Zip World is
Phone: +61 2 9253 5755              .     .      proudly part of the
Fax:   +61 2 9247 5276                . .     Pacific Internet Group
Received on Wed Jan 12 2000 - 17:39:46 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:20 MST