Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-903

Parameters of non-virtual functions should be used (MISRA C++ 0-1-11)

    XMLWordPrintable

    Details

    • Type: Finding Detection
    • Status: Closed
    • Resolution: Duplicate
    • Labels:
      None
    • Message:
      Remove this unused parameter "{}".
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Targeted languages:
      C#, C++, Java, JavaScript
    • Remediation Function:
      Linear
    • Linear Factor:
      10mn

      Description

      Unused function parameters are often due to design changes and can lead to mismatched parameter lists.

      Exception: An unnamed parameter in the definition of a function that is used as a callback does not violate this rule.

      Example:

      typedef int (*CallbackFn)(int a, int b);
      
      int Callback_1(int a, int b)                  // Compliant - "a" and "b" both used
      {
        return a + b;
      }
      
      int Callback_2(int a, int b)                  // Non-Compliant - "b" is unused
      {
        return a;
      }
      
      int Callback_3(int a, int)                    // Compliant - unnamed callback parameter exception
      {
        return a;
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              freddy.mallet Freddy Mallet (Inactive)
              Reporter:
              Anonymous Anonymous
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: