[Development] Are SiCs through #include cleanups considered acceptable?

Olivier Goffart olivier at woboq.com
Wed Apr 8 14:34:03 CEST 2015


On Wednesday 08 April 2015 13:13:19 Marc Mutz wrote:
> Hi,
> 
> I have in the past fixed #include mistakes such as #include
> <qsharedpointer.h> for QSharedDataPointer, and even though each time the
> issue came up that this is a SiC change (but only for users that unduly
> rely on indirect includes), so far they were always accepted.
> 
> When splitting off qHash() from qhash.h into qhashfunctions.h, I have come
> across many files that included qhash.h without using it, and likewise some
> for which qhashfunctions.h would suffice. One of them now got a -1 for being
> SiC.
> 
> Can we please decide once and for all whether #include cleanups that are
> technically SiC are ok or not, if they only affect users that rely on
> indirect includes?
> 
> My vote obviously goes to allowing them.

My vote goes against such gratuitous SiC changes.

Each little SiC changes add up in frustration for the developer who upgrades 
its Qt version.
So when it is easy to avoid, we should avoid it.

> Rationale: We're also allowing adding new overloads of functions, which is
> SiC for code that takes the address of a functions. We allow it, because
> there's an easy fix that is both forward and backwards-compatible:
> explcitly cast pointers to these functions. Something that should probably
> have been done defensively to begin with. So is #include'ing all required
> headers yourself.
> 
> It makes no sense to allow one and forbit the other.

I think you cannot really compare those two:

- One almost never take the address of a function. (Unless it is a signal or a 
slot, in which case i think it is best not to add overload)  While relying on 
indirect #include happens all the time as most only add the #include to fix a 
compilation error.
- Adding an overload often lead to a better API and is therefore something 
worth doing even if there is small breakage. Removing #includes might at best 
give a negligible impact on compilation speed.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org




More information about the Development mailing list