I was using an MFC-project, that shall be proted in a platform-independent environment, using std-function instead of MFC/AFX.
For example: instead CString the std::string, instead CMutex the std::mutex will be used.
What is the platform-independet, C++11 std::-equivalent of the MFC function "AfxIsValidAddress"?
There is not something similar to
AfxIsValidAddress()
in the standard library and it appears that the function doesn't actually do that much validation anyway.See AfxIsValidAddress (and Others) Don’t Work as Advertised which says the function ends up just doing a check against NULL. It also has this to say about the family of valid address check functions:
I think it is better to just follow standard C++ procedures to check that a pointer is not a
nullptr
or better yet to limit the use of pointers as much as possible.