[bt-devel] help needed for cleaning up kde4 port files

Martin Gruner mg.pub at gmx.net
Thu May 17 01:29:27 MST 2007


Hi Eeli.

Am Mittwoch, 16. Mai 2007 schrieb Eeli Kaikkonen:
> What's your policy about #include files in headers? I have understood
> that including other files than which are necessary for the including
> header file is not generally recommended. So it should be quite forward
> to find those includes which should be removed: just find all names in
> the file and make sure they are introduced, other includes can go away.
>
> But have you included in header files some files which are not used by
> the header but by some .cpp file including this header?

That may be the case, but it should not. Headers must only include what is 
reqired by the header file. The rest is included by the corresponding .cpp 
file.

> Also, is it good to give forwad declarations for some class names
> explicitly or just include their header files? For example in
> ckeychooserwidget.h there are both "#include <QWheelEvent>" and "class
> QWheelEvent;"
>
> Using class names may remove file dependencies and even shorten
> compilation time but otherwise I feel they should be removed and
> includes used instead. What do you say?

In headers, I'd prefer forward declarations instead of includes, if they are 
possible. In implementations you can use #includes.

> I would also like to know if you have found some easy way to compile one
> file without linking it. I can find it out myself but if you already
> have exprerience it would be easier.

I don't know yet.

mg



More information about the bt-devel mailing list