The existing C syntax defines character-constant as:
character-constant:
'
c-char-sequence '
L'
c-char-sequence '
Your question boils down to why this couldn't be defined instead as:
character-constant:
'
c-char
L'
c-char
Well, it could - in the sense that this would still be a consistent parseable grammar, and you'd still be able to express single-character constants. What you couldn't do is express multiple-character constants (eg. 'ab'
) - these are legal, but have a value that is implementation-defined.
I suspect that the true reason is simply aesthetics. For example, there's also no reason in theory why parantheses are needed around the conditional expression of an if
statement either.