Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
11.2 Interpretation
#1
With rule 11.2,

\"Conversions shall not be performed between a pointer to object and any type other than an integral type, another pointer to object type or a pointer to void\"

my understanding of the term

\"another pointer to object type\"

is, that for example code like

int* Source;
long* Target;
Target = (long*)Source;

doesn't violate this rule (but at least violates rule 11.4);
but our misra checker tool's interpretation of this rule is more like

\"another pointer to same object type\"

therefore it emits a misra violation for code structures like the one mentioned above.

To help me out, could you please tell me which interpretation is right?

Thanks in advance,
elmar
#2
MISRA-C Steering Team - 7th November 2006

The previous example is compliant with rule 11.2 but not compliant with rule 11.4.

An incorrect interpretation of the rule text was possible. The correct reading of this rule is as follows:

Conversions shall not be performed between a pointer to object and any type other than
(a) an integral type,
(b) another pointer to object type or
© a pointer to void.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)