MISRA Discussion Forums
Again on rule 11.2 and Exemplar Suite - 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: Again on rule 11.2 and Exemplar Suite (/showthread.php?tid=627)



Again on rule 11.2 and Exemplar Suite - roberto - 14-02-2009

I agree that one should not write code like

Code:
float32_1102 = ( float32_t ) void_ptr;           /* Not Compliant */
   float64_1102 = ( float64_t ) void_ptr;           /* Not Compliant */

However, my understanding is that those lines do not violate rule 11.2, even taking into account the clarification given in TC1.
Am I correct?
Thanks,

Roberto

P.S. I read the other thread on the forum, but the question was not answered. I saw that thread is locked, and I do not know what is the right way to resurrect a discussion. Please accept my apologies if opening another discussion is not appropriate.


Re: Again on rule 11.2 and Exemplar Suite - misra-c - 07-04-2009

These examples do not violate Rule 11.2 as this rule does not cover casts between pointers to void and floating point types. However, this behaviour is implicitly undefined as this type of cast is not listed in the permitted casts (see section 6.3.4 of the ISO C standard - cast operators). It is therefore a violation of Rule 1.2.