[Development] Should QVariant be doing fuzzy comparisons on doubles?

André Pönitz apoenitz at t-online.de
Mon Sep 19 19:47:12 CEST 2016


On Mon, Sep 19, 2016 at 09:20:48AM -0700, Thiago Macieira wrote:
> This code was there in Qt 5.0, so I kept it when I refactored the numeric 
> comparisons. Now, dealing with QTBUG-56073, I'm wondering if it should be 
> there in the first place.
> 
> Should we do fuzzy comparisns in QVariant?

No.

QVariant should not expose any numeric or conversion functionality and
*only* be used to store and retrieve data. Comparison/Ordering should
only be used and only be available to the degree needed to fullfil basic
container requirements. Everything else has bitten in the past, and
will necessarily continue to do so, and adding more conceptually *wrong*
features only digs deeper holes.

Andre'



More information about the Development mailing list