Rule 5.7 - Uniqueness of Tags as Identifiers - 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.7 - Uniqueness of Tags as Identifiers (/showthread.php?tid=1544) |
Rule 5.7 - Uniqueness of Tags as Identifiers - j-nafziger - 01-07-2020 Hi - The amplification in Rule 5.7 says that a tag shall be unique across all name spaces and translation units. Should this be read such that: - A tag shall be unique across (all tags in) all name spaces and translation units. - A tag shall be unique across (all identifiers in) all name spaces and translation units. The distinction I am drawing being could a unique identifier of a tag be reused for other non-tag identifiers? The examples in Rule 5.7 only show conflicts between tags and do not show conflicts between tags and other kinds of identifiers (labels, members, ordinary identifiers). For example is this code violating Rule 5.7 (reuse of 'device' as a member and a tag)? Code: struct clock { Thanks! Re: Rule 5.7 - Uniqueness of Tags as Identifiers - misra-c - 05-08-2020 The rule should be read as "A tag shall be unique across (all identifiers in) all name spaces and translation units." The example you give is non compliant with rule 5.7. |