![]() |
|
MISRA C:2012 Rule-5.3: (Required) |
|
||||
![]() | |||||||
Amplification:
An identifier declared in an inner scope shall be distinct from any identifier declared in an outer scope.
The definition of distinct depends on the implementation and the version of the C language that is being used:
Example Code:
#pragma PRQA_MESSAGES_OFF 2983
#include "misra.h"
#include "m3cmex.h"
struct ST0503
{
int16_t a;
int16_t b;
};
enum TE0503 { enx1, enx2, enx3 };
static enum TE0503 enva;
extern int16_t rule_0503( void )
{
int16_t enx1; /* 3334 */ /* Non-compliant - type hides object */
struct ST0503 /* 2547 */ /* Non-compliant - tag hides tag */
{
uint16_t x;
uint16_t y;
} sl;
return 1;
}
QAC messages that encompass this guideline:
| 2547 | This declaration of tag '%s' hides a more global declaration. |
| 3334 | This declaration of '%s' hides a more global declaration. |
|
||
(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 |