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.

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.

NoteNote

The SA_ prefix is optional for C++.

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

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();

Community Additions

ADD
Show:
© 2015 Microsoft