[Development] Changing qreal to a float

gunnar.sletta at nokia.com gunnar.sletta at nokia.com
Mon Feb 20 15:17:29 CET 2012


On Feb 20, 2012, at 2:36 PM, ext Thiago Macieira wrote:

> On segunda-feira, 20 de fevereiro de 2012 09.33.27, andre.poenitz at nokia.com 
> wrote:
>> This needlessly removes existing functionality. We promised to try
>> hard to not do that in the Qt 4-> Qt 5 transition. Removing the typedef
>> is essentially a showstopper for people currently relying on double.
>> 
>> Leaving the 'qreal' typedef (to float...) hurts less as it can be fixed by
>> recompilation,  and is not does not affect code size and performance
>> compared to a global search&replace.
> 
> How about we leave it defined to double in all platforms and deprecate it?

On embedded, this has the side effect that QML items would grow in size, and quite significantly as well. In addition, parts of scenegraph rendering would be slower as matrix multiplications are now double-base. These were the reasons for suggesting defining it to a float rather than a double in the first place. 

cheers,
Gunnar 

> 
> 
> $ gcc -xc++ -O3 -o /dev/null - <<EOF
> __attribute__((deprecated)) typedef double qreal;                                                      
> int main() { double x = 1.0; qreal y = x; return 0; }
> EOF
> <stdin>: In function ‘int main()’:
> <stdin>:2:36: warning: ‘qreal’ is deprecated (declared at <stdin>:1) [-
> Wdeprecated-declarations]
> 
> And then proceed to use float where we need float?
> 
> -- 
> 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
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list