|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-05-07 10:41:57
>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Sebastian Redl
>Sent: 07 May 2007 15:32
>To: boost_at_[hidden]
>Subject: Re: [boost] [HEAD] lexical_cast<int8_t>("127") bug?
>
>Paul A Bristow wrote:
>> I also recollect that I never understood why
>>
>> zz = lexical_cast<int>("0xffff"); // Fails!
>>
>> However I was more concerned about the floating-point
>problems, now sorted out,
>> and I didn't waste any brain activity on it.
>>
>That's because all lexical cast does is create a string stream and use
>the extractor to get the value out. The int extractor doesn't
>parse code
>style integers. It just looks at the base flag (oct, dec or hex) and
>expects the number to be in this format.
Obvious, now you point it out - but I don't recollect this being documented.
I'm sure I'll not be the last unthinking user to fall into this pit ;-)
Paul
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk