[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    Re: KDE review for KWeatherCore
From:       Volker Krause <vkrause () kde ! org>
Date:       2021-01-02 13:24:16
Message-ID: 7861136.T7Z3S40VBb () vkpc5
[Download RAW message or body]


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
["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic