Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity
    • Default Quality Profiles:
      Sonar way, MISRA C++ 2008 recommended
    • Legacy Key:
      EmptyCompoundStatement

      Description

      Noncompliant Code Example

      void foo()
      {
        int x;
        if (x == 42)
        /* Noncompliant - the following nested block is empty */
        {
        }
        else
        {
          printf("x != 42");
        }
      }
      
      void bar()
      /* Compliant - functions are not nested blocks */
      {
      }
      

      Compliant Solution

      void foo()
      {
        int x;
        if (x != 42)
        /* Compliant */ 
        {                
          printf("x != 42");
        }
      }
      
      /* ... */
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              massimo.paladin Massimo PALADIN
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: