Warning C28205
'function':
_Success_
or_On_failure_
used in an illegal context
The _Success_
and _On_failure_
annotations can only be used on function return values.
Examples
This sample shows how the warning finds a misplaced SAL annotation:
#include <sal.h>
// Oops, _Success_ is not valid in parameter lists, should be moved to return value.
bool GetValue( _Success_(return != false) _Out_ int *pInt, bool flag)
{
if(flag) {
*pInt = 5;
return true;
} else {
return false;
}
}
To correct the issue, move the SAL annotation to the return value:
#include <sal.h>
_Success_(return != false)
bool GetValue(_Out_ int *pInt, bool flag)
{
if(flag) {
*pInt = 5;
return true;
} else {
return false;
}
}
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for