This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] itoa
- From: Craig Howland <howland at LGSInnovations dot com>
- To: <newlib at sourceware dot org>
- Date: Mon, 8 Dec 2014 12:59:11 -0500
- Subject: Re: [PATCH] itoa
- Authentication-results: sourceware.org; auth=none
- References: <000001d01222$7f382b80$7da88280$ at beniston dot com> <20141208171737 dot GX3810 at calimero dot vinschen dot de>
On 12/08/2014 12:17 PM, Corinna Vinschen wrote:
On Dec 7 13:34, Jon Beniston wrote:
The attached patch adds support for the itoa and utoa functions, for
converting integers to strings.
This is a function that is supported on other platforms,
What other platforms? It appears in K&R, base 10 only, and it appears
in a Unix manual from 1971(*), but I can't find it in GLibc nor one of
The API is rather unsafe, given that the size of the buffer is not
checked (no size parameter). But what I'm really missing are checks for
the base parameter being valid. It could be > 36. Or negative.
Microsoft Visual Studio has a "safe" variant which adds the buffer size:
(See http://msdn.microsoft.com/en-us/library/0we9x30h.aspx, where they also have
some other flavors of it. They do define an error return for base out of range.)
I see how this may be useful for embedded targets, but in a standard C
library, I'm not so sure about.