I’m wondering whether it’s considered okay to do something like this.
if ( p_Pointer != NULL ) {
return p_Pointer;
} else {
return NULL;
}
Without the else, whatever. The point is that if the pointer is null, NULL is going to be returned, so it would seem pointless wasting a step on this. However, it seems useful for debugging purposes, because if I was stepping through with a debugger I would be able to check with this test if the pointer is NULL or not.
Any comments or suggestions regarding this practice?
It’s “okay” to do this, i.e. there’s nothing wrong with it, although it’s not very useful. If you’re stepping through in a debugger, you should be able to display the value of p_Pointer anyway.
It’s similar to
rather than just
return flag;