[Development] Fixing QRect::width() / height()

Poenitz Andre Andre.Poenitz at theqtcompany.com
Tue Mar 15 14:44:44 CET 2016

On Tuesday 15 March 2016 13:08:42 Bo Thorsen wrote:
> > Den 15-03-2016 kl. 14:07 skrev Marc Mutz:
> [...]
> > There is another option that doesn't mean a change of signature: Bound
> > the result. So if the real result is > INT_MAX, return INT_MAX. Same for
> > INT_MIN.
> >
> > Yes, it's not the correct result, but I completely agree with you that
> > it's a theoretical problem. As long as it's documented in the width() I
> > really don't see the problem with this solution.
> I like the idea to change width() to return a bounded result to avoid UB for
> old users, but we need a code path that returns the correct result for  new
> users without everyone of them going quint64(1) + r.right() - r.left() by
> themselves...

You seem to claim that new users would need 64 bit QRects.

This is unlikely.

Bo's proposal addresses the problem and does not require API 


More information about the Development mailing list