Reduced header file inclusions
Robby Stephenson
robby at periapsis.org
Tue Apr 10 07:56:03 MDT 2007
Thanks for the patch, Jens. Did you create it with some sort of tool that
checks include files, or just a lot of source file reading? :)
I do remember having some compilation issues of Fedora for some reason,
because of some include files I didn't think I needed. I don't know if that
was an issues because of an old KDE version or some Fedora specific,
though.
Robby
On Monday 09 April 2007, Regis Boudin wrote:
> Hi Jens,
>
> Thanks for the work :)
>
> I just tested your patch on a fairly wide range of gcc versions. The
> Debian gcc-snapshot was happy with it. Considering this one is supposed
> to be very strict regarding #include's, that's a good news. However, it
> failed when trying to build in a dapper chroot. Given that it's only an
> 8 months old distribution, I'm afraid it might affect some others...
>
> A slightly modified patch is on an other of my machines, I will post it
> soon.
>
> Regis
>
> On Mon, 2007-04-09 at 01:29 +0200, Jens Seidel wrote:
> > Hi Robby,
> >
> > I noticed that you normally try to minimize header inclusions. I
> > checked all header files in src/ for not needed #include statements and
> > was able to remove a few.
> >
> > Now you can drink an additional cup of coffee in the time which this
> > patch saves you during compilation :-)
> >
> > Once the compiler complained about an undefined "uint" which is
> > probably defined in a KDE or Qt header file. Please avoid using it for
> > compatibility reasons.
> >
> > The alias uint for unsigned int is defined in sys/types.h on POSIX
> > systems only. It is also available in pre C99 systems. ISO C99 provides
> > int8_t, ... in stdint.h but no uint.
> >
> > I think it is also a good idea to declare classes *after* header file
> > inclusion only. The reason is simple: If you include a header file
> > file.h which depends on a class X you will not get an error if you
> > forgot to declare X inside file.h (at least if X is defined before
> > inclusion of file.h).
> >
> > OK:
> >
> > #include "file.h"
> > class X;
> >
> > Not suggested:
> >
> > class X;
> > #include "file.h"
> >
> > (It could also be possible, that file.h gets parsed differently
> > dependant on whether X is declared or not. At least this is possible
> > with #define statements!).
> >
> > Jens
More information about the tellico-users
mailing list