-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71224/
-----------------------------------------------------------

(Updated Aug. 1, 2019, 11:03 a.m.)


Review request for mesos and Andrei Sekretenko.


Changes
-------

Tweak existing comment as suggested by asekretenko offline


Repository: mesos


Description
-------

The code intends to construct a seconds value too 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
conversions.

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
[-Wimplicit-int-float-conversion]
  framework.set_failover_timeout(99999999999999999);
              ~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~
```

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


Diffs (updated)
-----

  src/tests/master_tests.cpp b9ef13c31a9c3ae16e55d3ae8f9b1538a49cf49a 


Diff: https://reviews.apache.org/r/71224/diff/3/

Changes: https://reviews.apache.org/r/71224/diff/2-3/


Testing
-------

`make check`


Thanks,

Benjamin Bannier

Reply via email to