[haiku-bugs] Re: [Haiku] #10224: Changed some dynamic casts to reinterpret casts

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Tue, 19 Nov 2013 23:18:14 -0000

#10224: Changed some dynamic casts to reinterpret casts
   Reporter:  Ezodev                 |      Owner:  anevilyak
       Type:  bug                    |     Status:  new
   Priority:  normal                 |  Milestone:  R1
  Component:  Applications/Debugger  |    Version:  R1/Development
 Resolution:                         |   Keywords:  gci2013
 Blocked By:                         |   Blocking:
Has a Patch:  1                      |   Platform:  All

Comment (by bonefish):

 The cast operator you're looking for is static_cast, not reinterpret_cast.

 The unchecked dynamic_casts are really intended, though. In all cases the
 actual type of the object is ensured by other means. A mismatch would be a
 program error and the immediate crash caused by the NULL pointer would be
 desirable (a static_cast to a wrong type wouldn't necessarily cause an
 immediate crash). Performance isn't much of a concern in these cases. I
 don't know, maybe adding an ASSERT would be cleaner. Or alternatively
 dereferencing the original pointer and casting the reference (causing an
 exception on type mismatch).

Ticket URL: <http://dev.haiku-os.org/ticket/10224#comment:3>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: