static TCHAR szWindowClass[] = L"foo";
L is “glued” to the string "foo". How come? A function or a macro as I am used to is something like L("foo");
Can anyone explain me how come L be glued to the string?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Lis not a macro, it’s just the standard prefix for wide (wchar_t, “Unicode”) string literals; the concept is similar to theLsuffix forlong intliterals,fsuffix forfloatliterals and so on1.By the way, if you are using
TCHARs you shouldn’t be usingLdirectly; instead, you should use the_T()orTEXT()macro, that addsLat the beginning of the literal if the application is compiled “for Unicode” (i.e.TCHARis defined asWCHAR), or adds nothing if the compilation target is “ANSI” (TCHARdefined asCHAR).