std::lround advice ...

Michael Meeks michael.meeks at collabora.com
Wed May 16 12:00:10 UTC 2018


On 16/05/18 11:18, Stephan Bergmann wrote:
> while std::lround returns long.
>  For the latter, "[i]f the rounded value is outside the range of the
> return type, the numeric result is unspecified" (C11).  So the proposed
> tests would not work (and should not really be of interest for us,
> anyway, as the FRound versions cause UB to begin with).

	=) fair enough.

> For cases where the FRound version wouldn't have caused UB anyway
> because the value was outside the range of long, I /think/ using
> std::lround is a correct replacement.

	Hopefully we'll get similar UB ;-) but sounds like you're pro the change.

	Further thoughts most welcome, but sounds positive.

	Thanks !

		Michael.

-- 
michael.meeks at collabora.com <><, Pseudo Engineer, itinerant idiot


More information about the LibreOffice mailing list