11.2 Interpretation - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17) +---- Forum: 6.11 Pointer Type Conversions (https://forum.misra.org.uk/forumdisplay.php?fid=38) +---- Thread: 11.2 Interpretation (/showthread.php?tid=318) |
11.2 Interpretation - elmar - 16-10-2006 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 - 21-11-2006 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. |