locale and wchar_t in MSVC2008

T

thomas.r.aho

Hi all,

I have a problem with std::locale and MSVC2008 when I set the /
Zc:wchar_t- option. This setting means that the built-in type for
wchar_t is not used. Anyway, the operator(), which compares two
wstrings, works differently depending on this compiler setting. In the
example below, b should be true but evaluates to "false".

If I use the built-in type for wchar_t, it works like a dream! The
problem is that I use Qt, and this forces me to use the other compiler
setting.

Does anyone know how to get around this problem?

std::locale loc("German_germany");
//std::locale loc("Swedish_sweden");
std::wstring s1 = L"Pa";
std::wstring s2 = L"Öb";
bool b = loc(s1, s2);


/Thomas
 
C

Codeplug

Hi all,

I have a problem with std::locale and MSVC2008 when I set the /
Zc:wchar_t- option. This setting means that the built-in type for
wchar_t is not used. Anyway, the operator(), which compares two
wstrings, works differently depending on this compiler setting. In the
example below, b should be true but evaluates to "false".

If I use the built-in type for wchar_t, it works like a dream! The
problem is that I use Qt, and this forces me to use the other compiler
setting.

Does anyone know how to get around this problem?

std::locale loc("German_germany");
//std::locale loc("Swedish_sweden");
std::wstring s1 = L"Pa";
std::wstring s2 = L"Öb";
bool b = loc(s1, s2);


/Thomas

I'm using VC2008 SP1. I get "true" for "Swedish_sweden", and "false" for
"German_germany" - regardless of the built-in setting.

Do you have the latest service pack? Are you using a 3rd party STL like
STLport?

gg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top