You can use the operator for end torrent ## :
#define diagnostic_arg(message,...) fprintf(stderr,L##message,__VA_ARGS__)
However, it would be better to use the TEXT macro (if you're in Visual Studio), which will do what UNICODE defines:
#define diagnostic_arg(message,...) fprintf(stderr,TEXT(message),__VA_ARGS__)
If you do not, TEXT can be defined as follows:
#ifdef UNICODE #define TEXT(str) L##str #else #define TEXT(str) str #endif
However , if you plan to use another #define as the first argument for this macro (and indeed, even if you do not plan it), you will need another layer of indirection in the macro, so the definition will be evaluated instead of pasting it with L as text. See Mooing Duck's answer for how to do this, this is actually the right way to do this, but I am not deleting this answer because I want to keep my 80 rep.
source share