This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/32525] Request for new warning: useless dynamic_casts



------- Comment #4 from bangerth at dealii dot org  2007-06-27 19:17 -------
(In reply to comment #3)
> I think that's a good definition. My impression is that dynamic_cast is fairly
> expensive,

But only if the compiler can't know the actual type of an object (which
is exactly the case that you want to treat). If the actual type of an
object is known or if you are casting to a base class, dynamic_cast is as 
cheap as static_cast.

> "I doubt anyone will ever implement this."
> 
> I've gotten used to that. :)

Well, people implement what they consider important to them. PRs about
uninteresting
things will lie dormant until there are no interesting things left to 
implement.

I think everyone's time would be better used if you tried to find cases
where gcc doesn't produce a no-op for the constructs you want to warn
about. That would be a missed-optimization, rather than a more or less
uninteresting warning, and would receive more interest.

W.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32525


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]