You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> warning C28285: For function 'function_name', syntax error in 'annotation'
12
+
> For function '*function-name*', syntax error in '*annotation*'
13
13
14
-
The Code Analysis tool reports this warning for syntax errors in the SAL annotation. The SAL parser will recover by discarding the malformed annotation.
14
+
## Remarks
15
+
16
+
The Code Analysis tool reports this warning for syntax errors in the SAL annotation. The SAL parser will recover by discarding the malformed annotation. Double check the documentation for the SAL annotations being used and try to simplify the annotation. You should not use implementation layer annotations such as `__declspec("SAL_begin")` directly. If you are using that layer then change them into higher layers such as `_In_`/`_Out_`/`_Ret_`. See [Annotating Function Parameters and Return Values](annotating-function-parameters-and-return-values.md) for more information.
15
17
16
18
## Example
17
19
20
+
The following code generates this warning. The argument `(2,n)` is malformed and will cause a C28285 warning after the _Out_writes_z_ macro is expanded.
21
+
18
22
```cpp
19
-
// The argument '(n,2)' is malformed and will cause a C28285 warning after the _Out_writes_z_ macro is expanded.
20
23
voidexample_func(_Out_writes_z_((2,n)) char* buffer, int n)
21
24
{
22
-
// ...
23
-
buffer[n] = '\0';
25
+
buffer[n] = '\0';
24
26
}
25
27
```
26
28
27
-
Double check the documentation to the SAL annotations being used and try to simplify the annotation. You should not use implementation layer annotations such as `__declspec("SAL_begin")` directly. If you are using that layer then change them into higher layers such as `_In_`/`_Out_`/`_Ret_`. See [Annotating Function Parameters and Return Values](annotating-function-parameters-and-return-values.md) for more information.
29
+
The following code remediates this warning by correcting the malformed annotation
28
30
29
31
```cpp
30
32
void example_func(_Out_writes_z_(n) char* buffer, int n)
0 commit comments