I'd like to use the new C++ u8 string literal prefix (reference).
However the code base I'm using already typedefs u8 to be unsigned char. I can't practically move headers around or #undef around them.
How may I work around this?
It does not matter that u8
has been defined as a macro. A string literal, whether or not it has an encoding prefix, is a single preprocessor token. The u8
prefix will not undergo macro replacement. There is actually an example in Appendix C that demonstrates this:
#define u8 "abc"
const char *s = u8"def"; // Previously "abcdef", now "def"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With