Hello,

I am wondering if a defect has been introduced in the newer versions of MSVCRT.DLL and/or MSVCP60.DLL shipped with MS Windows Vista.

The following console application was written in MSVC 6.0 SP6 and compiled using the /MD switch. The /MD switch tells the compiler to use the C/C++ run-time libraries installed on the computer.

The tests verify that extracting and inserting a double from and onto a stream works when the computer's current locale has been applied to the stream using the stream's imbue member function.

When the program is compiled using the /MD switch, the tests in the program succeed when the program is run on MS Windows XP and earlier. However, the first test fails when the program is run on MS Windows Vista.

When the program is compiled using the /ML switch, which tells the compiler to link the C/C++ libraries into the program, the tests succeed when the program is run on all platforms including MS Windows Vista.

To be clear, when the imbue member function is not called, both tests succeed when the program is run on MS Windows Vista.

The versions of MSVCRT.DLL and MSVCP60.DLL on the machine running MS Windows Vista are both 7.0.6000.16386-11/02/2006-4:30AM.

The versions of MSVCRT.DLL and MSVCP60.DLL on my MS Windows XP SP2 machine are 7.0.2600.2180-8/4/2004-2:56AM and 6.2.3104.0-8/04/2004-2:56AM, respectively.

Here's the program.

// Imbue.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <locale>
#include <strstream>

// Locale setting at startup time
static std::locale kLocaleAtStartup ("");

int main(int argc, char* argv[])
{
// Test 1: Extracting a double from a stream using the current locale
{
std::istrstream s ("123123.123");
double d = 0;

s.imbue (kLocaleAtStartup); // Removing this line makes it work on Vista
s >> d;
if (s.fail () || !s.eof ())
printf ("Test 1: s >> d -> Failed\n");
else
printf ("Test 1: s >> d -> Passed (%.3f)\n", d);
}

// Test 2: Inserting a double onto a stream using the current locale
{
std::ostrstream s;
double d = 123123.123;

s.imbue (kLocaleAtStartup);
s.precision (15);
s << d << std::ends;
if (s.fail ())
printf ("Test 2: d >> s -> Failed\n");
else
{
printf ("Test 2: d >> s -> Passed (%s)\n", s.str ());
s.rdbuf ()->freeze (0);
}
}

return 0;
}

Has anyone heard of this problem in the C/C++ runtime libraries shipped with MS Windows Vista? Am I doing something incorrectly?

Thank you in advance for your help.

Richard