Turning off C++ casting??
Mongryong
Mongryong@sympatico.ca
Wed Feb 19 23:15:00 GMT 2003
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.
More information about the Gcc
mailing list