November 23, 2005The other topic: character literal types
> Oh, that minor concern was in regard to consistency here also. I have > no quibble with the character type being implied by content > (consistent with numeric literals): > > 1) The type for literal chars is implied by their content ('?', > '\u0001', '\U00000001') > > 2) The type of a numeric literal is implied by the content (0xFF, > 0xFFFFFFFF, 1.234) > > 3) The type for literal strings is not influenced at all by the > content. > > Further; both #2 & #3 have suffixes to cement the type, but #1 does > not (as far as I'm aware). These two inconsistencies are small, but > they may influence concerns elsewhere ... #1 is problematic. What if you have '\UFBDD' or something that does not fit in a byte. Or even 'ä'? At the very least, the compiler should MAKE THIS AN ERROR. In the old days, when we had 8-bit char sets, one could do that. But not now, when a character can potentially need more than 8 bits.