Rule 10.5 cast of enum to boolean - 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:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.10 The essential type model (https://forum.misra.org.uk/forumdisplay.php?fid=165) +---- Thread: Rule 10.5 cast of enum to boolean (/showthread.php?tid=1115) |
Rule 10.5 cast of enum to boolean - misra-c - 09-10-2014 Code: #include Am I correct to say that [1] is compliant with rule 10.5, but [2] is not compliant? Re: Rule 10.5 cast of enum to boolean - misra-c - 09-10-2014 After considering this situation, the MISRA working group has decided that the wording of the exception should be modified in a later Technical Corrigendum. The exception should only apply to expressions that are of essentially signed or essentially unsigned type. NOT_OK is an “essentially enum†type and would not be covered by the re-worded exception. Therefore both [1] and [2] should be considered as not compliant with rule 10.5 |