Typecasting from signed to unsigned and vis-verse - 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.10 Arithmetic Type Conversions (https://forum.misra.org.uk/forumdisplay.php?fid=37) +---- Thread: Typecasting from signed to unsigned and vis-verse (/showthread.php?tid=1091) |
Typecasting from signed to unsigned and vis-verse - deepabagalkot - 31-07-2014 Hi, Please can anybody help me to understand whether Misra C rules support signed to unsigned and vis-verse data typecasting? If there is requirement to do some manipulation on signed and unsigned values, then i think it is ok to type-caste. But the requirement given to us says that whenever there is typecasting happening from signed to unsigned and vis-verse, then such incident should be failed. Thanks in advance, Deepa Re: Typecasting from signed to unsigned and vis-verse - misra-c - 22-08-2014 Rule 10.1 of MISRA C:2004 prohibits implicit conversions for signed to unsigned and vice versa There are no restrictions on explicit casts between simple signed and unsigned expressions ( and vice versa ). For example: Code: UINT_8 u8 = .... Code: SINT_8 stemp; |