Compile speed up.

Josef Weidendorfer kde-optimize@mail.kde.org
Thu, 27 Feb 2003 11:21:34 +0100


On Thursday 27 February 2003 07:02, Benjamin Meyer wrote:
> I noticed that a lot of headers that include <qstringlist.h> also include
> <qstring.h>  The thing is that in qstringlist.h it includes qstring.h.  So
> the question is, is it safe to remove includes for qstring.h in headers
> that also have qstringlist.h?

Why want you do that?
The compile speed difference surely is neglectable: The preprocessor is 
skipping some lines if a file is included twice because every .h is in a 
#ifdef/#endif bracket: Compiled code is exactly the same.

OTOH, the user of <qstringlist.h> can't be sure that this will include 
<qstring.h>: If a forward declaration of QString would be enough for 
QStringList, <qstringlist.h> wouldn't have to include <qstring.h> at all.
And if Trolltech chooses to change their implementation and leave out 
<qstring.h> in <qstringlist.h> to have less dependencies, your files won't 
compile any longer.
AFAIK, QT major releases don't have to be source compatible.

Josef

>
> -Benjamin Meyer
>
> P.S. Same thing applies for qwidet/qobject includes etc.
> _______________________________________________
> Kde-optimize mailing list
> Kde-optimize@mail.kde.org
> http://mail.kde.org/mailman/listinfo/kde-optimize