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

Evaluation of the operand to the sizeof operator shall not contain side effects

    Details

    • Type: Bug Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Default Quality Profiles:
      MISRA C++ 2008
    • Legacy Key:
      SideEffectInSizeOf
    • Covered Languages:
      C, C++, Objective-C
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      30min

      Description

      This rule is a strict implementation of a MISRA (Motor Industry Software Reliability Association) rule. MISRA defines best practices for developing safety-critical software. You can learn more about this rule in the MISRA documents referenced below.

      If you are not concerned with MISRA compliance or with safety-critical software, you might consider using rule S3135 instead ; it targets the same kind of issue for general-purpose software.

      See

      • MISRA C 2004, 12.3 - The sizeof operator shall not be used on expressions that contain side effects.
      • MISRA C++ 2008, 5-3-4 - Evaluation of the operand to the sizeof operator shall not contain side effects.
      • MISRA C 2012, 13.6 - The operand of the sizeof operator shall not contain any expression which has potential side effects

        Attachments

          Issue Links

          1.
          C-Family RSPEC-4390 Language-Specification Active Unassigned

            Activity

              People

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

                Dates

                • Created:
                  Updated: