>
>
>
V751. Parameter is not used inside func…


V751. Parameter is not used inside function's body.

The analyzer detected a suspicious function where one of the parameters is never used while another parameter is used several times. It may indicate an error in the code.

Consider the following example:

static bool CardHasLock(int width, int height)
{
  const double xScale = 0.051; 
  const double yScale = 0.0278; 

  int lockWidth  = (int)floor(width * xScale);
  int lockHeight = (int)floor(width * yScale);
  ....
}

The 'height' parameter is never used in the function body while the 'width' parameter is used twice, including the initialization of the 'lockHeight' variable. There is very likely an error here and the code initializing the 'lockHeight' variable should actually look like this:

int lockHeight = (int)floor(height * yScale);

This diagnostic is classified as:

  • CERT-MSC13-C

You can look at examples of errors detected by the V751 diagnostic.