Edit

Share via


Warning C28303

For C++ reference-parameter <parameter_name>, an ambiguous _Deref_ operator was found on 'annotation'.

This warning similar to warning C28302 and is reported when an extra level of _Deref_ is used on a parameter.

SAL2 doesn't require the use of an extra level of _Deref_ when dealing with reference parameters. This particular annotation is ambiguous as to which level of dereference is intended to be annotated. It may be necessary to use _At_ to reference the specific object to be annotated.

Example

The following code generates this warning because the use of __deref_out_ecount(n) is ambiguous:

void ref(__deref_out_ecount(n) int **&buff, int &n)

The above annotation could be interpreted either as:

  • a reference to an array (of n) pointers to integers (SAL1 interpretation)

  • a reference to a pointer to an array (of n) integers (SAL2 interpretation)

    Either of the following changes can correct this warning:

void ref(_Out_writes_(n) int **&buff, int &n)
// or
_At_(*buff), _Out_writes(n)) void ref(int **&buff, int &n)