Quote:
Why undefined behavior? this is not undefined, the standard is explicit on this point. Types don't change anything as this is a semantics problem. Whatever type you use "c='a'" is not guaranteed to result in the same value on a different machine (or on the same machine with a different configuration). So if the program expects a precise encoding, I simply say this is not a good solution. But you're right for the readability issue, using raw codes is not a good idea, constants (or equivalent) are better in this case.
But the point is, that if we want a 'c', we want a 'c'. Using magic numbers, or static numbers will provide hard-to-read code and may result in undefined behavior on systems where 'c' isn't the same as on the other system you hard-coded the value on.