MISRA Discussion Forums
Relational operators and plain chars and wchar_t - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.4 Standard conversions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=133)
+---- Thread: Relational operators and plain chars and wchar_t (/showthread.php?tid=725)



Relational operators and plain chars and wchar_t - gs - 26-03-2010

The documentation for MISRA C++ rule #4-5-3 includes the following:
Quote:The relational operators = may be used to determine if a character (or wide character) represents a digit.
The document then includes several examples which demonstrate compliance (or lack thereof) for the '>=' and '


Re: Relational operators and plain chars and wchar_t - misra cpp - 05-10-2015

The use of "" is permitted. For example:

Code:
if ( ( x < '0' ) || ( x > '9' ) )
{
   /* Not a digit */
}