[previous] MISRA-C:2004  Rule  5.3:  (Required) [next] A typedef name shall be a unique identifier.
No typedef name shall be reused either as a typedef name or for any other purpose.

For example:

{
    typedef unsigned char uint8_t;
}
{
    typedef unsigned char uint8_t;   /* Not compliant - redefinition */
}
{
    unsigned char uint8_t;           /* Not compliant - reuse of uint8_t */
}

typedef names shall not be reused anywhere within a program. The same typedef shall not be duplicated anywhere in the source code files even if the declarations are identical. Where the type definition is made in a header file, and that header file is included in multiple source files, this rule is not violated.


QAC messages that encompass this guideline:

1506 The identifier '%1s' is declared as a typedef and is used elsewhere for a different kind of declaration.
1507 '%1s' is used as a typedef for different types.
1508 The typedef '%1s' is declared in more than one location.
3448 Declaration of typedef '%s' is not in a header file although it is used in a definition or declaration with external linkage.



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