Recently I encountered a class that had most member functions with a first line of
if (this == NULL)
return;
Since this is just passed as an implicit parameter to member functions, this doesn't seem to be undefined behavior. Some might even say it removes a burden on the client by removing the need to check for NULL whenever the client calls the function, but it's the first time I've ever seen such a check.
Is it undefined behavior to call a member function through a NULL pointer, so this check is required to be moved outside the member function?