Boost logo

Boost :

From: Corwin Joy (cjoy_at_[hidden])
Date: 2001-07-23 04:18:14


----- Original Message -----
From: "Kostya Altukhov" <kostya_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, July 23, 2001 2:54 AM
Subject: Re: [boost] a lexical_cast<> bug?

> Hello,
>
> I recently discovered even more surprising behavior of
> lexical_cast (at least on VC++6sp4):
>
> locale::global(locale("german"));
> // ...
> int i = 12345;
> string s = lexical_cast<string>(i); // this will succeed
> double d = lexical_cast<double>(s); // this will throw
>
> I am kinda cautious about using lexical_cast after that,
> especially when not in "C" locale...
>
> Kostya
>
Let me guess, the string comes out as "12.345" and then the lexical cast
from string is not locale aware. Actually, IMO the support for locales in
the standard library the comes with VC++ stinks. I was trying to write some
date library code and found out that the date facet is not supported other
than for the default 'C' locale. Likely this is due to VC6sp4 using a copy
of the dinkumware library that is several years old - has anyone tried a
newer copy of the Dinkumware lib? Also, of course, M$ wants to lock you in
to Microsoft specific locale code so they don't want to offer something
standard if they can just lock you in to a Windows API.

Corwin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk