Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.3 type qualifier
#4
Declarations with differing "Type specifiers" fall into two categories:

1. Non-compatible type specifiers are always constraint errors and violate rule 1.1. e.g.
Code:
extern void fn1 ( int x );
  void  fn1 ( long x ) { ... }  /* constraint error violates rule 1.1 */
2. Compatible type specifiers are permitted by this rule as clarified in the exception. e.g.
Code:
extern void fn2 (int y );
  void fn2 ( signed int y ) { ... }  /*  Compliant by exception ( though violates Directive 4.6 ) */
Therefore, this rule does not place any restrictions on the use of the C type specifiers beyond the constraints of the C language.

The rule does place a restriction on the use of typedef "names" in declarations. They must be the same even if they are defined to have the same basic type.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)