MISRA Discussion Forums

Full Version: 2.4 violation?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does the following example violate rule #2.4:
Code:
typedef enum A {
    b
} A;

A c() {
    return b;
}
Your example does violate rule 2.4, providing typedef “A” is always used in the rest of the translation unit and never “enum A”. A compliant typedef declaration could be written as
Code:
typedef enum {
        b
     } A;
This issue is similar to the example of record_t in the Example section for rule 2.4.