18.4 unions shall not be used - 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.18 Structures and Unions (https://forum.misra.org.uk/forumdisplay.php?fid=48) +---- Thread: 18.4 unions shall not be used (/showthread.php?tid=257) |
18.4 unions shall not be used - Manni - 16-05-2006 Hello I use unions in the following example. And I want to know, if in such a situation the use of unions is compliant or not compliant to MISRA-C:2004. Or if somebody has a better idea for a good implementation. Code: Example_Ports.h /* eg. a processor library of a processor manufacturer */ A. What do you think of this little example. Good user, or bad work? B. Compliant to rule 18.4, a situation in which unions could be used? Or not. And then, how we could do it in a MISRA-C:2004 way? thanks a lot Best regards, Manni BTW: Big thanks for your help in my last threads. My MISRA Guide proceed. - misra-c - 22-08-2006 MISRA-C meeting 22-8-2006 The use of unions always requires a deviation. See discussion under 18.4 for further guidance and examples. The decision to accept a deviation is for the organisation writing the software. MISRA cannot endose any specific deviation method. |