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

Functions should not be defined with a variable number of arguments

    Details

    • Default Severity:
      Critical
    • Impact:
      High
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Legacy Key:
      FunctionEllipsis
    • Covered Languages:
      C, C++, Java, Objective-C
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      30min
    • Analysis Scope:
      Main Sources, Test Sources
    • CERT:
      DCL50-CPP.
    • MISRA C 2004:
      16.1
    • MISRA C++ 2008:
      8-4-1
    • PC-Lint:
      9165

      Description

      Passing arguments via an ellipsis bypasses the type checking performed by the compiler. Additionally, passing an argument with non-POD class type leads to undefined behavior. Note that the rule specifies "defined" (and not "declared") so as to permit the use of existing library functions.

      Noncompliant Code Example

      void MyPrintf ( char_t * pFormat, ... )	// Noncompliant
      {
        // ...
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Anonymous
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: