How to: Annotate C++ Code
To annotate code in C++, you first include the SourceAnnotations.h file and then use the vc_attributes namespace.
To annotate code in C++
Add the #include <CodeAnalysis/SourceAnnotations.h> file to your project header file.
Next, add the using namespacevc_attributes; statement.
Example
After adding the include file and the namespace, you annotate C++ code as shown in the following code:
// MyCode.h
#include <CodeAnalysis/SourceAnnotations.h>
using namespace vc_attributes;
class CMyClass
{
public:
void f ( [Pre ( Valid = Yes )] int *pWidth );
// code ...
};
// MyCode.cpp
#include "MyCode.h"
void CMyClass::f ( [Pre (Valid = Yes)] int pWidth )
{
}
In C, you must use the SA_ prefix for enumerated property values. In C++, SA_ prefix is optional.