This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: std_sstream.h - patch
- To: libstdc++@sourceware.cygnus.com
- Subject: Re: std_sstream.h - patch
- From: Nathan Myers <ncm@best.com>
- Date: Wed, 26 May 1999 21:05:15 -0700 (PDT)
>
> >> 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