Reduced header file inclusions
Regis Boudin
regis at boudin.name
Mon Apr 9 10:32:12 MDT 2007
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
> _______________________________________________
> tellico-users mailing list
> tellico-users at forge.novell.com
> http://forge.novell.com/mailman/listinfo/tellico-users
More information about the tellico-users
mailing list