mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Subject Re: Review Request 64729: Made `Duration::operator*` accept `int` and `size_t`.
Date Mon, 08 Jan 2018 22:27:45 GMT


> On Jan. 5, 2018, 2:14 p.m., Joseph Wu wrote:
> > 3rdparty/stout/include/stout/duration.hpp
> > Lines 173 (patched)
> > <https://reviews.apache.org/r/64729/diff/2/?file=1932982#file1932982line173>
> >
> >     Why sacrifice the precision of integer * integer multiplication?
> >     
> >     ```
> >     nanos = nanos * multiplier;
> >     ```
> >     (You might need to `friend` one of these operators to get this to work)
> >     
> >     Same with the other operator.

I'm not sacrificing it because we didn't have it to begin with:

```
  Duration operator*(double multiplier) const
  {
    Duration product = *this;
    product *= multiplier;
    return product;
  }
```

Where are you seeing a `Duration operator*(int multiplier)`?


- Andrew


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


On Jan. 5, 2018, 1:53 p.m., Andrew Schwartzmeyer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/64729/
> -----------------------------------------------------------
> 
> (Updated Jan. 5, 2018, 1:53 p.m.)
> 
> 
> Review request for mesos, Greg Mann, Jie Yu, Joseph Wu, and Michael Park.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Without this change, every use of `Duration * 2` throws a conversion
> warning because we multiple `Duration` by `int` and `size_t` without
> casting to `double` (the type accepted by the actual implementation of
> `operator*`).
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/duration.hpp d10b6a4d4d1a0096334c30fdec725ecc55c9f0ea

> 
> 
> Diff: https://reviews.apache.org/r/64729/diff/2/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andrew Schwartzmeyer
> 
>


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