Re: Review Request 45489: Replaced reinterpret_cast with static_cast in libprocess.

2016-04-08 Thread Ben Mahler

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


Ship it!




Ship It!

- Ben Mahler


On March 30, 2016, 4:16 p.m., Neil Conway wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45489/
> ---
> 
> (Updated March 30, 2016, 4:16 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Casting from a virtual base class to a child class should not be
> done with reinterpret_cast. We could use dynamic_cast as well, but
> that has a performance cost; in this case, we know exactly which
> child class the pointer points to, so the performance cost and
> additional safety offered by dynamic_cast is not necessary.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/src/process.cpp 
> feaffa4334422ec3964f8d079f570061eaf390d2 
> 
> Diff: https://reviews.apache.org/r/45489/diff/
> 
> 
> Testing
> ---
> 
> make check with GCC 5.3 and recent apple-clang.
> 
> 
> Thanks,
> 
> Neil Conway
> 
>



Re: Review Request 45489: Replaced reinterpret_cast with static_cast in libprocess.

2016-03-30 Thread Mesos ReviewBot

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



Patch looks great!

Reviews applied: [45318, 45319, 45488, 45489]

Passed command: export OS='ubuntu:14.04' CONFIGURATION='--verbose' 
COMPILER='gcc' ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1'; ./support/docker_build.sh

- Mesos ReviewBot


On March 30, 2016, 4:16 p.m., Neil Conway wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45489/
> ---
> 
> (Updated March 30, 2016, 4:16 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Casting from a virtual base class to a child class should not be
> done with reinterpret_cast. We could use dynamic_cast as well, but
> that has a performance cost; in this case, we know exactly which
> child class the pointer points to, so the performance cost and
> additional safety offered by dynamic_cast is not necessary.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/src/process.cpp 
> feaffa4334422ec3964f8d079f570061eaf390d2 
> 
> Diff: https://reviews.apache.org/r/45489/diff/
> 
> 
> Testing
> ---
> 
> make check with GCC 5.3 and recent apple-clang.
> 
> 
> Thanks,
> 
> Neil Conway
> 
>



Re: Review Request 45489: Replaced reinterpret_cast with static_cast in libprocess.

2016-03-30 Thread Neil Conway


> On March 30, 2016, 3:03 p.m., Benjamin Bannier wrote:
> > 3rdparty/libprocess/src/process.cpp, line 1531
> > 
> >
> > Here and below: Either explicitly assert that the `dynamic_cast` does 
> > not return `NULL`, or use `static_cast`.
> > 
> > Since `Encoder` seems to implement its own idea of polymorphism it 
> > seems `static_cast` might fit better.
> 
> Neil Conway wrote:
> Hmmm -- I thought `static_cast` was only safe for downcasts when the 
> parent class is non-virtual?
> 
> Benjamin Bannier wrote:
> It is fine for most cases, but cannot be used e.g., in the presence of 
> virtual *inheritance* (which isn't used here).

Double-checked with mpark -- sounds good. Thanks!


- Neil


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


On March 30, 2016, 4:16 p.m., Neil Conway wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45489/
> ---
> 
> (Updated March 30, 2016, 4:16 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Casting from a virtual base class to a child class should not be
> done with reinterpret_cast. We could use dynamic_cast as well, but
> that has a performance cost; in this case, we know exactly which
> child class the pointer points to, so the performance cost and
> additional safety offered by dynamic_cast is not necessary.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/src/process.cpp 
> feaffa4334422ec3964f8d079f570061eaf390d2 
> 
> Diff: https://reviews.apache.org/r/45489/diff/
> 
> 
> Testing
> ---
> 
> make check with GCC 5.3 and recent apple-clang.
> 
> 
> Thanks,
> 
> Neil Conway
> 
>



Re: Review Request 45489: Replaced reinterpret_cast with static_cast in libprocess.

2016-03-30 Thread Neil Conway

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

(Updated March 30, 2016, 4:16 p.m.)


Review request for mesos and Ben Mahler.


Changes
---

Use static_cast instead of dynamic_cast.


Summary (updated)
-

Replaced reinterpret_cast with static_cast in libprocess.


Repository: mesos


Description (updated)
---

Casting from a virtual base class to a child class should not be
done with reinterpret_cast. We could use dynamic_cast as well, but
that has a performance cost; in this case, we know exactly which
child class the pointer points to, so the performance cost and
additional safety offered by dynamic_cast is not necessary.


Diffs (updated)
-

  3rdparty/libprocess/src/process.cpp feaffa4334422ec3964f8d079f570061eaf390d2 

Diff: https://reviews.apache.org/r/45489/diff/


Testing (updated)
---

make check with GCC 5.3 and recent apple-clang.


Thanks,

Neil Conway