[Development] Rules for including private headers

Ulf Hermann ulf.hermann at digia.com
Mon Feb 17 10:46:12 CET 2014


> 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. In case 3 
(<QtCore/private/whatever_p.h>), as we are using private API of a 
different module, that should really be visible in the code, I think.

I'm aware that those rules are pretty complex and the idea of one syntax 
to cover them all has its merits, but maybe we should take another look 
at the pros and cons.

-- 
Ulf Hermann, Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Registergericht: Amtsgericht Charlottenburg, HRB 144331 B,

Digia Germany is a group company of Digia Plc,
Valimotie 21, FI-00380 Helsinki Finland



More information about the Development mailing list