Boost logo

Boost :

Subject: Re: [boost] lexical_cast optimization
From: Othman, Ossama (ossama.othman_at_[hidden])
Date: 2008-12-03 14:11:11


Hi,

>Please do not proceed at the expense of error handling. I believe using
>itoa
>and ftoa is fine, but using atoi and atof is definitely not:
>
> cout << atoi("123X") prints 123
> cout << atoi("X") prints 0
>
>lexical_cast<int> throws in both cases, which I think is 100% the correct
>behaviour.

Would strtol() and friends be suitable from a performance point of view? They at least provide some error reporting.

-Ossama


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