Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 6.1
#1
In the Amplification for Rule 6.1 :

For C99 : The appropriate types are :

1. either unsigned or signed int.
This refers to unsigned int and signed int only OR any other datatype..?

2. Another explicitly signed or explicitly unsigned integer type that is premitted by the implementation.
What all types does this refer to ? Does this refer to unsigned short OR unsigned short int etc.

Please clarify.
<t></t>
#2
Paragraph 4 of the constraints section 6.7.2.1 of the C99 standard states:
"A bit-field shall have a type that is a qualified or unqualifed version of _Bool, signed int, unsigned int or some other implementation-defined type."

The phrase "implementation-defined type" refers to both
* standard integer types (excluding unsigned int and signed int)
and
* implementation-defined extended integer types
providing your implementation supports those types in a bit-field declaration.

Going back to your question.
"unsigned and signed int" bit-fields are permitted by all implementations and will always be compliant with this rule.

Other explicitly signed integer types such as "unsigned short" may or may not be compliant with this rule, depending on whether such types are supported as bit-fields by your implementation.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)