Rule 5.6 A ty pedef name shall be a unique identifier - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.5 Identifers (https://forum.misra.org.uk/forumdisplay.php?fid=160) +---- Thread: Rule 5.6 A ty pedef name shall be a unique identifier (/showthread.php?tid=1422) |
Rule 5.6 A ty pedef name shall be a unique identifier - xiaoxin - 09-05-2018 My doubt about this rule is if they violate rules in different files, as follows.If they violate the rules in the same project. a.c Code: void func ( void ) Code: void func ( void ) c.c Code: int a =8; Code: void main(){ Looking forward to your reply。 Re: Rule 5.6 A ty pedef name shall be a unique identifier - xiaoxin - 11-05-2018 anybody here? Re: Rule 5.6 A ty pedef name shall be a unique identifier - misra-c - 04-10-2018 Each of the MISRA C:2012 rules has an analysis scope which applies to them. This is described in section 6.6 of the document. Rule 5.3 has the analysis scope of "Single Translation Unit". This means that each .c file and its associated header files are looked at on their own. When looking a file "d.c", the file "c.c" is not considered and therefore there is no violation of rule 5.3. However, it is a violation of rule 5.8 which requires objects with external linkage to be unique across the "System" of files. Rule 5.6 has the analysis scope of "System", which means that files "a.c" and "b.c" should be considered together. The example will violate rule 5.6. |