Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 2.4 and forward declarations
#2
The use of tag in a typedef is not a violation of rule 2.4, unless the only occurrence of the tag appears in the typedef declaration.
Code:
struct A { ... };                 // compliant
typedef struct A Atype;  
Atype ax;                                  
     // no subsequent use of identifier "A"  

typedef struct B { ... } Btype;  // non-compliant
Btype bx;                              
    // no subsequent use of identifier "B"

typedef struct { ... } Ctype;   // compliant
Ctype cx;
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)