Edit

Share via


Warning C28300

<parameter_name>: Expression operands of incompatible types for operator <operator_name>

This warning fires a SAL annotation contains an expression containing incompatible types.

Example

union MyUnion
{
  int length;
  //...
};

// Oops, int and MyUnion are not compatible with the + operator.
void f(_In_reads_(10 + value) int *buffer, MyUnion value)
{
  for(int i = 0 ; i < (10 + value.length); i++)
  {
    //...
  }
}

In the previous example, the developer forgot to access the appropriate member variable. In other cases, you may need to fix the error with an explicit cast.

void f(_In_reads_(10 + value.length) int *buffer, MyUnion value)
{
  for(int i = 0 ; i < (10 + value.length); i++)
  {
    //...
  }
}