[Development] QUIP 6: removing top-level const from return types

Thiago Macieira thiago.macieira at intel.com
Wed May 24 23:49:06 CEST 2017


On Wednesday, 24 May 2017 12:09:41 PDT Marc Mutz wrote:
> I maintain that they were forgotten. Well, or ignored.
> 
>  From a quick grep in QtBase, two that caught my eye:
> 
> - qvector.h: The solution is obvious, straight-forward, and BiC:
>    unexport QPolygon(F). Wasn't done. Wouldn't've broken anything.

That would imply exporting each of the out-of-line functions. That idea never 
occurred to us back then (and I still dislike because it uglifies the headers, 
but it's a reasonable solution for QPolygon(F)). Without this possibility in 
our pockets, the solution was incredibly hard and therefore matches my 
criteria.

> - qregexp.cpp: They're also about removing const: from member
>    functions, this time. Code breaks, but is trivial to fix.

We were expecting to remove the entirety of QRegExp, so no one bothered 
because it would have been a wasted effort.

Also, they WERE removed. And then brought back in a git revert. See 
babd3e252b87a3b9c91cd44189d4fcb5cd8ab270. So this again qualifies as "not 
easy".

> If we don't even remember to do _that_ kind of trivial change, how can
> we, with a straight face, claim that we will handle all the ### Qt 6
> ones?

Let's try again. Find me trivial ### Qt5 that we left over.

> There are already 236 "### Qt 6" instances today, in QtBase alone.
> They all need to be looked at, understood, maybe re-evaluated, and
> implemented. The ones protected with QT_VERSION checks, otoh, will
> become active the day Ossi flips the switch and calls dev 6.0.0.

And we'll find issues like the qregexp one that don't work or break too much 
because no one tested them, but unlike a steady change where we can detect 
what change caused the breakage, we'll get them all at once and we'll have to 
spend time investigating.

I'm not saying we shouldn't use the QT_VERSION_CHECK trick, but we should use 
it judiciously.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list