Mixing plain char and non-plain char within ?: - 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.6 Types (https://forum.misra.org.uk/forumdisplay.php?fid=33) +---- Thread: Mixing plain char and non-plain char within ?: (/showthread.php?tid=723) |
Mixing plain char and non-plain char within ?: - gs - 24-03-2010 The commentary for rules #6.1 and #6.2 state, Quote:[T]he second and third operands of the ternary conditional operator may both be of plain char type.Do these rules permit one of these two operands to have plain char type and the other to have signed char or unsigned char type? For that matter, what about the mixing of such operands with operators considered acceptable for use with objects of plain char type? For example, do the rules permit the following: Code: void function( char a, signed char b ) Re: Mixing plain char and non-plain char within ?: - misra-c - 13-05-2010 These rules do not preclude operating on a mixture of plain char and signed/unsigned char types using assignment, equality or conditional operators. However, this is not recommended and is likely to be precluded in a future revision of the MISRA C Guidelines. |