MISRA Discussion Forums

Full Version: Rule 5.7 - Uniqueness of Tags as Identifiers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 {
    u32     device;  /* Device is a 'member' */
} ;
struct device;  /* device is a tag */

Thanks!
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.