std_sstream.h - patch
Nathan Myers
ncm@best.com
Thu Dec 30 07:30:00 GMT 1999
>
> >> I checked this in, thanks. I saved the dynamic_cast: it does not harm
> >> the generated code, is legal c++, and clarifies that a conversion from
> >> derived to base is happening.
> >
> > I would think that should be a static_cast, then.
>
> dynamic_cast<B*>(D*)
> No?
> (if it was the inverse, I'd use the static_cast)
No. dynamic_cast<> is for use where you are not sure about the
validity of the conversion, and want the compiler to check. It
indicates to the reader that something iffy is going on.
Nathan Myers
ncm@cantrip.org
More information about the Libstdc++
mailing list