help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic_cast problem revisited:


From: Earl Purple
Subject: Re: dynamic_cast problem revisited:
Date: 9 Aug 2006 01:14:22 -0700
User-agent: G2/0.2

Bernd Strieder wrote:
> You are doing things that are not guaranteed to work everywhere, that
> are non-standard. And it is more a linker problem.

ok, well strictly C++ has no concept of a library and no such concept
as dlopen().
I do always export objects rather than functions because casting void*
to a function
pointer is undefined behaviour, in fact a function pointer might not
fit into void* and
doesn't on some systems (void* can often be 32-bit while function
pointers are 64-bit).

dynamic_cast is part of C++ standard. It does have its uses, in fact
plug-ins is the
only time I ever use it. That is because you receive an object and want
to verify it
is the type you expected so if it isn't you can handle the error
cleanly (by throwing
an exception) rather than invoking undefined behaviour (as would occur
with any
other type of cast if you then called member functions on it).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]