[PATCH] itoa

Corinna Vinschen vinschen@redhat.com
Tue Dec 9 19:31:00 GMT 2014


On Dec  9 10:45, Jon Beniston wrote:
> Hi Corinna,
> 
> > Given that this is non-standard anyway, what about creating a safer 
> > alternative instead, along the lines of Craig's/Freddie's itoa_s/np?
> >
> > Also, shouldn't the functions start with an underscore so as not 
> > to pollute the standard namespace?  itoa and utoa are very likely 
> > not uncommon as function names in existing projects.
> 
> Perhaps. I wrote it so that some existing code would compile though. In stdlib.h, it's in a #ifndef __STRICT_ANSI__ block next to dtoa() et al., which I presume are just as non-standard. 
> 
> >> I've also modified it as per Freddie's suggestion.
> >
> > Did you test it?  AFAICS, the itoa function never returns the sign:
> 
> Oops, not Freddie's version. Updated version attached.

Thanks!  I just had a private talk with Jeff, and we came to the
conclusion that the functionality would be nice to have.  We would just
both prefer that the functions get double-underscored and the
non-underscored names are provided as macros, along the lines of

  extern char *__itoa();
  extern char *__utoa();
  #if !strict_ansi
  #define itoa __itoa
  #define utoa __utoa
  #endif

This way we keep the namespace clean and still can use the functions
inside newlib as well.

Hope that's ok.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20141209/d9909336/attachment.sig>


More information about the Newlib mailing list