[previous] MISRA C:2012  Rule-5.2:  (Required) [next] Identifiers declared in the same scope and name space shall be distinct

Amplification:

This rule does not apply if both identifers are external identifers because this case is covered by Rule 5.1.

This rule does not apply if either identifer is a macro identifer because this case is covered by Rule 5.4 and Rule 5.5.

The definition of distinct depends on the implementation and on the version of the C language that is being used:

Example Code:


#include "misra.h"
#include "m3cmex.h"

            /* 1234567890123456789012345678901 *****/
static int32_t b23456789012345678901234567;
static int32_t b23456789012345678901234567890;                  /*      */      /* Compliant */

            /* 1234567890123456789012345678901 ******/
static int32_t a234567890123456789012345678901234;
static int32_t a234567890123456789012345678901234x;             /* 0779 */      /* Non-compliant */

extern int16_t rule_0502(void)
{
       /* 1234567890123456789012345678901 ******/
  int32_t a234567890123456789012345678901234y;                  /* 0779 */      /* Not-compliant with Rule 5.3 */

  return 1;
}




QAC messages that encompass this guideline:

0779 [U] Identifier does not differ from other identifier(s) (e.g. '%s') within the specified number of significant characters.


Related rules:

Rule-1.3 There shall be no occurrence of undefined or critical unspecified behaviour



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents