------- Comment #3 from lloyd at randombit dot net  2007-06-27 19:06 -------
"I haven't seen such code written in the first place ever."

Neither had I, until I found out it is endemic in a large project at work.  

I'd just as soon write a script to find these cases, but figuring out what the
type of the casted-from pointer/reference is can be somewhat nontrivial.

"Warnings are for cases where either code may not do what you expect, or where
a certain way of coding has a significant cost that can be avoided."

I think that's a good definition. My impression is that dynamic_cast is fairly
expensive, and while it is great that GCC noops out this case I suspect not all
compilers will do the same; at this point I'm not even sure that GCC does it
consistently. So I'd figure it a reasonable case for a warning as per your
second condition.

"I doubt anyone will ever implement this."

I've gotten used to that. :)


-- 


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

Reply via email to