MISRA Discussion Forums
Was something missed for 12.6 about "?:"? - 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.12 Expressions (https://forum.misra.org.uk/forumdisplay.php?fid=39)
+---- Thread: Was something missed for 12.6 about "?:"? (/showthread.php?tid=735)



Was something missed for 12.6 about "?:"? - gs - 06-05-2010

The wording of advisory #12.6 indicates expressions other than effectively boolean ones are permitted as the conditional argument to "?:". Was this wording an oversight? In three other circumstances, the guidelines insist on effectively boolean expressions and it seems unintuitive to not require such in this case as well.


Re: Was something missed for 12.6 about "?:"? - misra-c - 13-05-2010

It is intended that the first operand of the ternary operator should be effectively Boolean. This will be made clear in a future revision of the MISRA C Guidelines.