Rule 8.3 type qualifier

Moderators: misra-c, david ward

Post Reply
Motozo Mario Ikeda
Posts: 7
Joined: Mon Aug 03, 2015 1:14 am
Company: DENSO

Rule 8.3 type qualifier

Post by Motozo Mario Ikeda » Fri Oct 07, 2016 2:38 am

"Type qualifier" and "Storage class specifier" are mentioned in Rule 8.3, but "Type specifier" is not.

Should we think "Type qualifier" includes "Type specifier"?

Thank you,
Mario Ikeda

dg1980
Posts: 109
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: Rule 8.3 type qualifier

Post by dg1980 » Tue Oct 11, 2016 8:25 am

Doesn't rule 8.4 cover mixing type specifiers between declaration and definition?

Motozo Mario Ikeda
Posts: 7
Joined: Mon Aug 03, 2015 1:14 am
Company: DENSO

Re: Rule 8.3 type qualifier

Post by Motozo Mario Ikeda » Thu Oct 13, 2016 3:33 am

Another idea was occurred.

I thought the "name" of the rule means "parameter name" and "typedef name".
But if this includes "type name", "Type specifier" is also mentioned in the rule.

Does this idea work?

Thank you,
Mario Ikeda

misra-c
Posts: 571
Joined: Thu Jan 05, 2006 1:11 pm

Re: Rule 8.3 type qualifier

Post by misra-c » Fri Dec 09, 2016 8:52 am

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: Select all

  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: Select all

  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

Post Reply

Return to “8.8 Declarations and defnitions”