Boost logo

Boost :

Subject: Re: [boost] [lexical_cast] A non-throwing lexical cast? [Was: 5 Observations - My experience with the boost libraries]
From: Pete Bartlett (pete_at_[hidden])
Date: 2010-03-25 17:59:34


Kim Barrett wrote:
> On Mar 24, 2010, at 5:20 PM, Bruno Santos wrote:
>>boost::bad_lexical_cast is not derived from
>>my_project::invalid_user_input o or whatever. This happens a lot with
>>boost::lexical_cast.
>>

>If the user data is data that comes from a file or user interface, I
>agree in your assertion.
>
>However, if it's from someone using your library, it's an obvious
>programming error, doing exception translation in this case is
>pointless.

Agreed, but the source of data in a text format that should be a numeric
format is much more likely to be end-user systems and inputs rather than
that created within a client application, IME.

>Anyway, in my opinion, passing a boost::system::error_code as the second
>parameter for a non throwing version would be the best solution.

As Jeff points out, others have been here before us, and it looks like the
proposed Boost.StringConvert is the result of prior discussions. Perhaps our
energies would be best spent making sure that library meets our needs by
being reviewers or even the review manager [one is still needed, according
to the schedule].

Pete


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