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


> A dynamic_cast from an inherited class to its base does not make any sence
> at all, but it takes a lot of execution time. 
> The time of a call of dynamic_cast is comparable to the one of the 'log'
> function.

You did not actually validate this claim before making it, did you?

Consider

struct MyClass
{
 virtual ~MyClass();
};

struct Derived:MyClass{
};

MyClass* foo(Derived* p)
{
 return dynamic_cast<MyClass*>(p);
}

For the function foo, g++ 2.95, -S -O2 -fomit-frame-pointer, generates

foo__FP7Derived:
.LFB1:
	movl 4(%esp),%eax
	ret

I wouldn't exactly call that "a lot of execution time".

Regards,
Martin


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