[Development] Changing qreal to a float
Thiago Macieira
thiago.macieira at intel.com
Mon Feb 20 16:02:09 CET 2012
On segunda-feira, 20 de fevereiro de 2012 14.34.57, andre.poenitz at nokia.com
wrote:
> Thiago Macieira [thiago.macieira at intel.com]
>
> > [...] How about we leave it defined to double in all platforms and
> > deprecate it?
> Replacing all 'qreal' occurrences with 'double' would be a significant
> performance hit for some embedded people. Replacing all 'qreal'
> occurrences with 'float' spoils the fun for some desktop people. [Replacing
> it with anything else would not help at all,] so (a) leaving qreal in the
> code _or_ (b) immediately add QRectD/QPolygonD/... substitutes are the only
> ways I see to deliver on the "you don't have to completely rewrite your
> code" promise for both sides.
We can't "fix" it unless we keep the current detection logic. Since it would be
a deprecated type anyway, we could keep the logic anyway -- minus the presence
of QT_COORD_TYPE.
I also thought we had agreed that QRectF should be float on all platforms and
we don't need double-precision geometric classes anyway.
> I have no strong opinion on which of (a) or (b) to choose, all I want to
> make sure is that we will neither force people to use doubles on ARM, even
> if they don't need it, nor force people currently relying on precise
> coordinates to use floats.
I don't think we can achieve that.
> As both (a) and (b) are both feasible approaches to solve the issue I don't
> see a reason to go for an approach that leaves either user group out in the
> rain.
My proposal is (in-order):
1) replace qreal with double where it should have been double all along
(interfacing with system APIs that have double)
2) replace qreal everywhere else with float
3) remove the #ifdef QT_COORD_TYPE check in qglobal.h
4) add Q_DECL_DEPRECATED to the two typedef definitions of qreal and wrap them
in QT_DEPRECATED_SINCE(5,0):
#if QT_DEPRECATED_SINCE(5, 0)
# if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
Q_DECL_DEPRECATED typedef float qreal;
# else
Q_DECL_DEPRECATED typedef double qreal;
# endif
#endif
5) (optional) add QRectD & family
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Intel Sweden AB - Registration Number: 556189-6027
Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120220/350c24de/attachment.sig>
More information about the Development
mailing list