Abraxas/Misra Home  Table of Contents

Module - m70.html

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.

Misra-C Test Suite for Module - m70.c

/* Misra C Enforcement Testing */

Misra C Enforcement Testing */

/* Rule 70: Required */

Rule 70: Required */

/* Functions shall not call themselves either directly or indirectly. */

Functions shall not call themselves either directly or indirectly. */

/* It is trivial to detect direct recursion, but it can in some cases */

It is trivial to detect direct recursion, but it can in some cases */

/* be impossible to detect indirect recursion statically. */

be impossible to detect indirect recursion statically. */
#include "misra.h"
SI_32
rule70 ( SI_32 a ) 



Function Name: rule70()

{
    
SI_32 c;
    
    switch ( a ) 
    {
        
        case 0:
        case 1:
        c = 1;
        break;
        
        default:
        if ( a < 0 ) 
        {
            
            c = ( -1 ) ;
            
        }
        else
        {
            
            c = a * rule70 ( a-1 ) ; /*  RULE 70  */
            
        }
        break;
        
    }
    
    return c;
    
}

Abraxas/Misra Home  Table of Contents

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.