Abraxas/Misra Home  Table of Contents

Module - m42.html

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

Misra-C Test Suite for Module - m42.c

/* Misra C Enforcement Testing */

Misra C Enforcement Testing */

/* Rule 42: Required */

Rule 42: Required */

/* The comma operator shall not be used, except in the control */

The comma operator shall not be used, except in the control */

/* expression of a for loop. */

expression of a for loop. */
#include "misra.h"
SI_32
rule42 ( void ) 



Function Name: rule42()

{
    
SI_32 a = 3;
SI_32 i = 3;
SI_32 j = 3;
SI_32 c = 3;
    
    a = i++, i+j; /*  RULE 42  */
    a = (  (  (  ( i++, i+j )  )  )  ) ; /*  RULE 42  */
    a = (  (  (  ( i++ ) , ( i+j )  )  )  ) ; /*  RULE 42  */
    
    for ( i = 0, j = 0; i < 10; ++i, ++j ) 
    {
        

/* DO NOTHING */

DO NOTHING */
        
    }
    
    c = j;
    
    return c;
    
}

Abraxas/Misra Home  Table of Contents

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