No, there is no "standard" macro for this. The standard is to prefix wide lines with L and omit the prefix from narrow lines.
The only reason this macro should even exist is because you target platforms that do not support Unicode in different ways. In this case, everything should be a narrow line. If you are not dealing with platforms that do not support Unicode, then everything should probably be widespread.
The _T and TEXT macros are given in the Windows headers for this purpose: support for a single code base that can be compiled for both Windows NT that supports Unicode and Windows 9x that does not support Unicode.
I canโt imagine why you need such a macro if you have not yet included the Windows headers, but if you do, just write it yourself. Except that you need to know when string literals should be wide strings and when they should be narrow strings. There is no "standard" #define . Windows headers use the UNICODE preprocessor character, but you cannot rely on this being defined on other platforms. So, now you are back to where you started.
Why do you think you need a macro for this again? If you strictly encode the string type as wchar_t* , then you will always want to use a wide character literal, so you always want to use the L prefix.
When you use _T and / or TEXT macros from Windows headers, you also do not hardcode the string type as wchar_t* . Instead, you use the TCHAR macro, which automatically resolves the appropriate character type depending on the definition of the UNICODE character.
source share