This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Turning off C++ casting??
- From: Mongryong <Mongryong at sympatico dot ca>
- To: gcc at gnu dot org
- Date: 19 Feb 2003 17:51:27 -0500
- Subject: Turning off C++ casting??
Is there a way to disable C++ casting? That is, during
development/debugging I like using C++ casts like dynamic_cast to ensure
my parameters are correct. However, for a release build where I'm
confident 'all down-casting' is safe, I would like the casting to be
turn off - that is, something similar to 'C' type casting:
// Debug build
void func(BaseObject& obj) {
ExtendedObject& obj = dynamic_cast<ExtendObject&>(obj);
//...
}
// Release build
void func(BaseObject& obj) {
ExtendedObject& obj = *((ExtendObject*)((void*)arg)); // release build
//...
}
Correct me if I'm wrong, but I believe the release build is faster.