[Development] Rules for including private headers

Koehne Kai Kai.Koehne at digia.com
Mon Feb 17 13:04:10 CET 2014



> -----Original Message-----
> From: development-bounces+kai.koehne=digia.com at qt-project.org
> [mailto:development-bounces+kai.koehne=digia.com at qt-project.org] On
> Behalf Of Ulf Hermann
> Sent: Monday, February 17, 2014 10:46 AM
> To: development at qt-project.org
> Subject: Re: [Development] Rules for including private headers
> 
> > Sounds good to me. From what I read below, you just add the section
> > about private headers, right?
> 
> Yes.
> 
> >> * If you need to include qt_x11_p.h, always include it as the last
> >> header file.
> > This could go into the private headers section since it's private itself.
> 
> I'd rather just delete it. What is so significant about qt_x11_p.h that it needs
> its own rule here?
> 
> > Please merge all cases into one:
> > 	#include <private/whatever_p.h>
> 
> The argument for case 1 ("whatever_p.h") is that it's shorter and easier to
> see where the file is than with <private/whatever_p.h>.

> Both cases 1 and 2
> ("foo/bar/whatever_p.h") reduce the amount of indirection to look up the
> file and possibly speed up compile times that way.

I did a quick reality check on this one: https://codereview.qt-project.org/#change,78318 changes all _p.h includes to a canonical <private/xxx_p.h> format, and I couldn't measure any difference when compiling on windows (where filesystem accesses are traditionally slow), both with and without patches applied.

So I'd actually also support just using <private/xxx_p.h> everywhere.

Regards

Kai



More information about the Development mailing list