[PATCH] [PUSHED] IDE: PTR_CAST, ISA -> dynamic_cast

Stephan Bergmann sbergman at redhat.com
Tue Aug 7 09:08:01 PDT 2012


On 08/07/2012 03:28 PM, Caolán McNamara wrote:
> Btw, isn't there some issue that dynamic_cast/typeinfo stuff is quite
> slow under msvc or some such ?, i.e. no biggy for the "occasional" cast,
> but a potential problem for say, mass converting the ISA uses in the sw
> layout code.

Indeed, dynamic_cast used to be rather expensive for mass use even with 
GCC at least a couple years back, IIRC.  That's why configmgr uses 
switch(node->kind()) instead of dynamic_cast to dispatch on the 
different Node subtypes.  (And such dispatching IMO makes for cleaner 
code there than using virtual functions, keeping coherent functionality 
together.  Sometimes you want an "algebraic data type plus functions 
pattern-matching over it" approach in OO languages, too.)

Stephan


More information about the LibreOffice mailing list