For portable applications, use only the assignment = operator, the equality operators == and !=, and the unary & operator on plain character or plain wide character-typed expressions.
Wiki Markup |
---|
This is recommended because the C99 standard requires only the digit characters ('0' - '9') to have consecutive numerical values \[[C99 N1401]\]. Thus, operations that rely on expected values for plain character or plain wide character-typed expressions can lead to unexpected behavior. |
However, due to the requirement for digit characters, the usage of other operators is allowed for them according to the following restrictions:
...
Wiki Markup |
---|
This rule appears in the C++ Secure Coding Standard as \[[cplusplus:STR07-CPP. Don't assume numeric values for expressions with type plain character]\]. |
References
Wiki Markup |
---|
\[[C99 N1401]\] Section 5.2.1 "Character sets" |