11.2 Interpretation

6.11 Pointer Type Conversions

Moderators: misra-c, david ward

Locked
elmar
Posts: 1
Joined: Fri Oct 13, 2006 6:15 am
Company: Liebherr-Aerospace Lindenberg GmbH

11.2 Interpretation

Post by elmar » Mon Oct 16, 2006 7:54 am

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

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

Post by misra-c » Tue Nov 21, 2006 3:14 pm

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
(c) a pointer to void.
---
Posted by and on behalf of
the MISRA C Working Group

Locked

Return to “6.11 Pointer Type Conversions”