C++ Call a non-virtual non-static method from a null pointer, without accessing members : is this guaranteed to work? [duplicate]
问题 This question already has answers here : Is it legal/well-defined C++ to call a non-static method that doesn't access members through a null pointer? (5 answers) When does invoking a member function on a null instance result in undefined behavior? (2 answers) Closed 5 years ago . Can I call a non-static, non-virtual method of a class from a null pointer? The member function would then test if this==nullptr, and return immediately if it's true. I know it will work in most cases, but is this a