Share via


Using Annotations to Reduce C/C++ Code Defects

Annotations enable a function to explicitly state the behavior of parameters and return values before and after the function is called. This additional information provided by the developer is used by the code analysis tool to detect violations of the contract between the caller and the callee. The annotation scheme is implemented as Visual C++ compiler attributes.

Important

This topic applies only to Source Annotation Language (SAL) 1.0 annotations in Visual C++ 2010.

The following sections provide more information about attributes and how they are defined and applied.

In This Section

Annotation Overview

Describes annotations, attributes, properties, and usage.

How to: Annotate C++ Code

Shows how to annotate C/C++ code that is compiled by using the /TP option.

How to: Annotate C Code

Shows how to annotate C/C++ code that is compiled by using /TC option.

Annotation Properties

Describes properties that you can use when you annotate code.

Reference

Attributed Programming Concepts