DRAFT document on coding conventions in kde libraries

Andras Mantia amantia at kdewebdev.org
Mon Mar 6 11:19:20 GMT 2006


> On Monday 06 March 2006 10:44, Thiago Macieira wrote:
>> Allan Sandfeld Jensen wrote:
>> >It is unreliable across shared libaries. If you have a non-QObject
>> based
>> >heirachy you should implement your own type-system rather than rely on
>> >dynamic_cast.
>>
>> I'd rather people used dynamic_cast<> rather than write and rewrite
>> their
>> own system.
>>
>> They just have to be warned against the pitfalls that it may represent.
>> In
>> special: do not ever use dynamic_cast in a class that is not marked
>> _EXPORT.
>>
> I don't think that will help with dlopen'ed libraries or plugins.

Ok, I'm confused now. Certainly I never experienced such problems. A Kpart
id dlopened, right? If you load the katepart editor and want to use its
interfaces you do it by dynamic_cast-ing a lot. I never had problems. So
can you give a real example where dynamic_cast can fail?

Andras




More information about the kde-core-devel mailing list