[Development] QUIP 6: removing top-level const from return types
Olivier Goffart
olivier at woboq.com
Tue May 23 08:59:12 CEST 2017
Am Dienstag, 23. Mai 2017, 08:36:00 CEST schrieb Lars Knoll:
> > On 23 May 2017, at 07:26, Marc Mutz <marc.mutz at kdab.com> wrote:
> >
> > On Tuesday 23 May 2017 00:48:53 Thiago Macieira wrote:
> >> Then we are right now concluding this kind of change should not be in
> >> that
> >> part of the QUIP.
> >
> > The QUIP gives an _algorithm_ to categorise SiCs, it's not a listing.
> > There's a list, yes. It's called _examples_.
> >
> >> if there's a chance of existing code breaking
> >
> > How can removing top-level const from a return type "break" existing code
> > any more than adding a function overload?
>
> Probably not more than that, you are right.
>
> But what I dislike is the fact that we get different signatures on different
> platforms (because we can't change this on MSVC without breaking BC). That
> can cause some unwanted side effects (a detach happening on Linux, but not
> on MSVC), and incompatibilities in Qt between different platforms (code
> that compiles on Linux doesn't compile on MSVC). These are side effects of
> such a change that we need to take into account when considering whether
> it's worth changing this in 5.x.
Another difference is that if one call
QPixmap pix;
//...
pix = splashScreen->pixmap();
This would call the copy operator if the function return a const QPixmap, but
the move operator if there is no const.
--
Olivier
Woboq - Qt services and support - https://woboq.com - https://code.woboq.org
More information about the Development
mailing list