This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Turning off C++ casting??


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?


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