I have seen and used C++ code like the following:
int myFourcc = 'ABCD';
It works in recent versions of GCC, not sure how recent. Is this feature in the standard? What is it called?
I have had trouble searching the web for it...
EDIT:
I found this info as well, for future observers:
from gcc documentation
The compiler values a multi-character character constant a character at a time, shifting the previous value left by the number of bits per target character, and then or-ing in the bit-pattern of the new character truncated to the width of a target character. The final bit-pattern is given type int, and is therefore signed, regardless of whether single characters are signed or not (a slight change from versions 3.1 and earlier of GCC). If there are more characters in the constant than would fit in the target int the compiler issues a warning, and the excess leading characters are ignored.
For example, 'ab' for a target with an 8-bit char would be interpreted as
(int) ((unsigned char) 'a' * 256 + (unsigned char) 'b')'
, and '\234a' as(int) ((unsigned char) '\234' * 256 + (unsigned char) 'a')'
.
"Note that according to the C standard there is no limit on the length of a character constant, but the value of a character constant that contains more than one character is implementation-defined. Recent versions of GCC provide support multi-byte character constants, and instead of an error the warnings multiple-character character constant or warning: character constant too long for its type are generated in this case."