<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] warning cleared



On Thu, 22 Sep 2005, Vincent Lefevre wrote:

On 2005-09-21 14:36:03 -0700, Brendan Cully wrote:
Is strtoul as portable as atoi? Every time I see a nicer interface to
an old function I assume it means I can't actually use it...

strtoul is standard and was already in K&R C. Moreover, it has a
well-defined behavior (i.e. you can check for errors), contrary to
atoi, which can lead to undefined behaviors. So, it is much better
to use strtoul.

The error-checking aspect wasn't in K&R C (but otherwise agree: you can take the existence of strtol() for granted).

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net