Yes, you are wrong. There's no conversion whatsoever.
_T() and TEXT() simply specify L in front of your strings
when compiling for UNICODE thus making them use wide
characters. You should use LPTSTR and LPCTSTR for your
character pointers and TCHAR for your character arrays.
BTW, there's a lot of confusion about Unicode, so let me
state clearly that wide-characters != Unicode. Wide characters
under Windows = UTF-16. Wide characters under Linux
= UTF-32. UNICODE can be used with both wide and
narrow characters. In the latter case you'd use UTF-8, which
is the preferred format for Linux and Mac OS X.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"George" <George@discussions.microsoft.com> wrote in message
news:779B429C-7688-4B79-BCD8-22D59B8DADF4@microsoft.com...
Hello everyone,
I think when UNICODE or _UNICODE is defined, when using _T, it could
convert
characters to wide character.
And I also think LPCSTR should be defined to pointer to wide character
when
UNICODE or _UNICODE is defined, and LPCSTR should be defined to pointer to
multibyte character when UNICODE and _UNICODE are not defined.
But it seems I am wrong for all points. Could anyone explain to me why I
get
such warnings in Visual Studio 2003?
[CODE]
#include <windows.h>
#include <TCHAR.h>
#define UNICODE
#define _UNICODE
int main (int argc, char** argv)
{
WCHAR* p = _T("hello");
LPCSTR p1 = p;
LPCWSTR p2 = p;
}
[/CODE]
warning messages,
warning C4133: 'initializing' : incompatible types - from 'char [6]' to
'WCHAR *'
warning C4133: 'initializing' : incompatible types - from 'WCHAR *' to
'LPCSTR'
thanks in advance,
George