how to initialize one char as TCHAR

hello,
I'm confused about characters
if
TCHAR x = 'ä'; //ae umlaut in German
the result x is negative.

if
LPCWSTR s = _T("ä");
the result of s[0] is positive

how to guarantee to get always the unsigned equivalence?

Thank you for patience
to answer this basic question

Erhy

In 2's compliment they will both be the same value anyway as long as they're both the same byte count (which a single character should be)
It'll most likely just e down to whatever you're using to output the value of the character, say that the print fiction might always take char strings as unsigned because it's pretty sure it'll be letters, where as a single wchar is a short, so it's possible it gets picked up as a numerical representation. The value on memory will be the same though
the solution is to type L'ä'
http://msdn.microsoft.com/en-us/library/windows/desktop/aa367308(v=vs.85).aspx

it would be nice if there is a compiler, which uses long characters as standard
for avoiding the care in type all _T( and L' .

Erhy
If you use the L your char will always be wide, thus rendering TCHAR() pointless.

if you want just wide chars go with
wchar_t ch = L'A';

otherwise go with
TCHAR ch = _T('A');
this will compile 8 or 16 bits chars.
Topic archived. No new replies allowed.