|
From: Roger H. <rog...@mi...> - 2007-03-29 20:03:37
|
> Is there any case in which it is not a bug for 'this' to be NULL? I > can't find one. I suggest that instead of adding FastGetClass, we > just > change the implementation of OpaqueTQ3Object::GetClass to > > Q3_ASSERT( this != NULL ); > return theClass; > > so that in non-debug builds it will just return theClass. Also > GetClass > could be made inline. I have looked through and only found places where at least one of the following applies: The object pointer has been tested for nil beforehand. The object pointer has been de-referenced beforehand so would have already crashed. The function's result is used in a way which does not allow nil. So yes, I agree, lets change the function, only two files to change, the header and the source. Well spotted. Roger. |