The macro #define STR16(x) L ## x
works when applied to string literals:
STR16("Hello") // fine, this is translated to L"Hello"
but not to variables:
STR16(x) // fails, this is translated to Lx, and the variable Lx doesn't exist
In line 200 of this useful library, there is a bug:
Parameter* param = new RangeParameter( STR16(p->GetNameForHost()), ...
will be translated to
Parameter* param = new RangeParameter( Lp->GetNameForHost(), ...
which fails, because Lp
is an undeclared identifier.
How to do the same than adding L
to a string literal, to a string variable const char *
?