KDE review for KWeatherCore
Volker Krause
vkrause at kde.org
Sat Jan 2 13:24:16 GMT 2021
On Samstag, 2. Januar 2021 12:44:31 CET Dominik Haumann wrote:
> This is just by looking at the first two header files.
>
> Looking at WeatherForecast.cpp:
>
> double maxTemp = std::numeric_limits<double>::min();
> double minTemp = std::numeric_limits<double>::max();
>
> Initializing the temperature to 0, 0, sounds a bit more sane to me, but
> that is disputable I guess.
Nice find. This looks quite familiar, the weather forecast accumulation code
in Itinerary does something very much like this, to make std::min/std::max
work without special-casing invalid values.
However the way it's done here will fail for negative max temperatures, as
std::numeric_limits<double>::min() is not what one might expect (it's the
smallest positive value for floating point types), you want
std::numeric_limits<double>::lowest().
Regards,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20210102/2c56a963/attachment.sig>
More information about the Kde-frameworks-devel
mailing list