Edit

Share via


Warning C6509

Invalid annotation: 'return' cannot be referenced from a precondition

Remarks

This warning indicates that the return keyword can't be used in a precondition. The return keyword is used to terminate the execution of a function and return control to the calling function.

Code analysis name: RETURN_USED_ON_PRECONDITION

Example

The following code generates this warning because return is used in a precondition:

#include <sal.h>

int f (_In_reads_(return) char *pc)
{
    // code ...
    return 1;
}

To correct this warning, use the following code:

#include <sal.h>

int f (_In_reads_(i) char *pc, int i)
{
    // code ...
    return 1;
}