This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Turning off C++ casting??
- From: Mongryong <Mongryong at sympatico dot ca>
- To: Mike Stump <mstump at apple dot com>
- Cc: gcc at gnu dot org
- Date: 19 Feb 2003 19:01:43 -0500
- Subject: Re: Turning off C++ casting??
- References: <B11C8538-4464-11D7-B22E-003065A77310@apple.com>
On Wed, 2003-02-19 at 18:48, Mike Stump wrote:
> On Wednesday, February 19, 2003, at 02:51 PM, Mongryong wrote:
> > Is there a way to disable C++ casting?
>
> #define and #ifdef, but only if you are really sure you want to do this
> and your application spends 30% or more of its time in this code. We
> aren't going to help you hang yourself here, but the method should be
> fairly obvious. If it isn't, maybe you shouldn't consider doing it.
>
Are you talking about #ifdef the code where I dynamic_cast takes place?
ie.
#ifndef NDEBUG
ExtendedObject& obj = dynamic_cast<ExtendedObject&>(baseObj);
#else
ExtendedObject& obj = *((ExtenedObject*)((void*)&baseObj));
#endif
What I want to know is whether GCC allows you to optimize
'dynamic_cast'ing: gcc -fno_dynamic_cast .... I don't think gcc has
such a switch.
Does GCC allow you to override built in C++ casts? If so, how do I do
it?