_ATL_ENABLE_PTM_WARNING

Define this macro in order to force the use of ANSI C++ standard-compliant syntax for pointer to member functions. Using this macro will cause the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.

#define _ATL_ENABLE_PTM_WARNING

Remarks

The ATL and MFC libraries have been changed to match the Visual C++ compiler's improved standard C++ compliance. According to the ANSI C++ standard, the syntax of a pointer to a class member function should be &CMyClass::MyFunc.

When _ATL_ENABLE_PTM_WARNING is not defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) to allow legacy code to continue building as before. If you define _ATL_ENABLE_PTM_WARNING, your code should be C++ standard compliant.

However, the non-standard form has been deprecated, so you need to move existing code to C++ standard compliant syntax. For example, the following:

BEGIN_MESSAGE_MAP(CMFCListViewDoc, CDocument)
   ON_COMMAND(ID_MYCOMMAND, OnMycommand)
END_MESSAGE_MAP()

Should be changed to:

BEGIN_MESSAGE_MAP(CMFCListViewDoc, CDocument)
   ON_COMMAND(ID_MYCOMMAND, &CMFCListViewDoc::OnMycommand)
END_MESSAGE_MAP()

Note that for map macros that add the '&' character, you should not add it again in your code.

See Also

Reference

Compiler Warning C4867

Other Resources

Compiler Options Macros