Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Annotate C Code

To annotate code in C, you include the SourceAnnotations.h file and then use the attributes to annotate function parameters or return values.

To annotate code in C

  1. Add the #include <CodeAnalysis/SourceAnnotations.h> file to your project header file.

  2. Next, use the attribute to annotate code.

Example

The following code shows how to annotate C code:

// MyCode.h
#include <CodeAnalysis/SourceAnnotations.h>

// MyCode.c
#include "MyCode.h"
void f ( [SA_Pre (Valid = SA_Yes)] int pWidth )
{
  // code...
}

In C++, SA_ prefix is optional.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft