KDE & ARM (and introduction post to kde-core-devel)

Ingo Klöcker kloecker at kde.org
Sun May 31 13:17:53 BST 2009


On Friday 29 May 2009, Aaron J. Seigo wrote:
> On Friday 29 May 2009, Lubos Lunak wrote:
> > On Friday 29 of May 2009, Aaron J. Seigo wrote:
> > > for the interest of others, the most common reason this problem
> > > poked its head up in plasma was when doing something like this:
> > >
> > > qreal value = 1;
> > > .. some code ..
> > > value = qMax(0.0, value);
> > >
> > > this works just fine on archs like intel where qreal == double,
> > > but fails to build on arm. solution is simple:
> > >
> > > value = qMax(qreal(0.0), value);
> >
> >  Making code ugly everywhere is not exactly a simple solution.
> > Would the simple solution work (i.e. adding the necessary qMax
> > overloads)?
>
> that makes a lot of sense imo for archs where qreal != double. qMin,
> qBound and the rest would need the same, of course, but then it would
> be transparent to the app dev and a lot less ugly in the app code, as
> you note.

qMax, qMin, qBound are template methods [1]. So adding 
overloads/specializations makes no sense and won't help. I suppose the 
problem is that the compiler cannot decide what type to use (double or 
float) if qreal != double, so giving the compiler a hint is the only 
solution. IMO, writing the above as
  value = qMax<qreal>( 0.0, value )
is a bit nicer (because it's more obvious).


Regards,
Ingo


[1] http://doc.trolltech.com/4.5/qtglobal.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090531/159d2a66/attachment.sig>


More information about the kde-core-devel mailing list