Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2.4 violation?
#1
Does the following example violate rule #2.4:
Code:
typedef enum A {
    b
} A;

A c() {
    return b;
}
Reply
#2
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.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)