Anything inside double quotes is going to be null terminated. Always.
It doesn't matter if it's by itself... with a 'L' prefix, or inside a TEXT macro. If it has double quotes, it is null terminated.
What if my program is running on a version of windows that's not using unicode? |
Windows has been using Unicode under the hood since WinNT. Unless you are targetting Win9x machines I wouldn't worry about it.
But the question is: does this conversion take place at compile time or while program is running? |
That depends on you.
If you have UNICODE/_UNICODE defined, then it's compile time. If not, then it'll be converted at runtime after you pass the ANSI string to any WinAPI function.
Cause if it takes place while program is running, then that will slow down my program and I want it to be as fast as possible |
It won't slow down your program in any noticeable way unless you are doing TONS of conversions. Don't sweat the small stuff.
Besides... working with wide characters might be slower because it means using more memory and moving more memory around. It's not always as simple as "Unicode is faster" or "Unicode is slower". There are lots of other factors.
TCHARs are retarded. But if you must use them... then they are effectively a typedef of either
char
or
wchar_t
depending on whether or not UNICODE/_UNICODE macros are defined.
If you are "using Unicode" (meaning you have UNICODE/_UNICODE defined), then TCHAR==wchar_t... and MessageBox==MessageBoxW, etc. IE: it's all UTF-16 and the conversion is done at compile time.