Dela via


MustCheck

The MustCheck property specifies whether the caller must inspect the return value of a function. This property is used as a post condition on the return value of a function.

The MustCheck property must be set by using one of the following values:

  • SA_Yes - the return value must be checked; otherwise warning 6031 is issued.

  • SA_No - the return value should not be checked.

Note

The SA_ prefix is optional for C++.

Remarks

Checking a return value of a function marked with SA_No does not generate a warning.

Example

The following code shows how to use the MustCheck property:

// C 
#include <CodeAnalysis\SourceAnnotations.h>
[returnvalue:SA_Post(MustCheck=SA_Yes)] int f();

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
[returnvalue:Post(MustCheck=Yes)] int f();

See Also

Other Resources

Annotation Properties