We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


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.


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:


Should be changed to:

   ON_COMMAND(ID_MYCOMMAND, &CMFCListViewDoc::OnMycommand)

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