This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: std_sstream.h - patch


> 
> >> 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


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