LWN.net Logo

A turning point for GNU libc

A turning point for GNU libc

Posted Mar 29, 2012 4:52 UTC (Thu) by slashdot (guest, #22014)
In reply to: A turning point for GNU libc by Richard_J_Neill
Parent article: A turning point for GNU libc

Are you sure about atoi supporting octal?

AFAICT POSIX 2008 forbids that, and requires atoi to support only decimal numbers.

At any rate, changing that is probably highly unwise, as it might break stuff.


(Log in to post comments)

A turning point for GNU libc

Posted Mar 29, 2012 10:37 UTC (Thu) by Richard_J_Neill (subscriber, #23093) [Link]

D'oh! You're quite right about atoi(). I meant strtol(), but wasn't thinking straight. strtol() allows you to optionally specify the base=10, but then won't permit 0x... for hexadecimal.

I agree that we can't change it right away. That's why I suggest adding a new prefix, "0o" to be used in the very rare case where the programmer deliberately intends to use octal. That wouldn't break anything, and over perhaps 5 years, people could migrate.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds