mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Bannier <>
Subject Review Request 71224: Removed lossy `long` to `double` conversion in a test.
Date Thu, 01 Aug 2019 08:37:22 GMT

This is an automatically generated e-mail. To reply, visit:

Review request for mesos and Andrei Sekretenko.

Repository: mesos


The code intends to construct a seconds value to large to fit into the
internal representation in nanoseconds, but since the `long` value was
passed to a function expecting a `double` the value will implicitly be
converted. As the `long` value is large, `double` is not able to
represent all possible `long` values which can lead to lossy

This is exactly what happened here. Recent clang has a warning to catch
such issues at compile time if possible,

../src/tests/master_tests.cpp:7194:34: warning: implicit conversion from
'long' to 'double' changes value from 99999999999999999 to 1.0E+17
              ~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~

This patch changes the value to `1e+17` (a `double` value) which removes
the lossy conversion, and still accomplishes what the test required.


  src/tests/master_tests.cpp b9ef13c31a9c3ae16e55d3ae8f9b1538a49cf49a 



`make check`


Benjamin Bannier

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message