This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/44574] Avoid use of atoi
- From: "jsm28 at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 May 2011 21:12:39 +0000
- Subject: [Bug other/44574] Avoid use of atoi
- Auto-submitted: auto-generated
- References: <bug-44574-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574
--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-05-12 21:08:14 UTC ---
There are also uses of atol, atoll and atoq to eliminate. Also note some Ada
code using atoi (surely there must be a more idiomatic Ada way of doing this?).
It would be best to poison all these functions when the uses are eliminated.
In some cases the use of atoi may be allowing a wider range of inputs (in terms
of leading whitespace and trailing unrecognized characters) than should
actually be allowed in the context.
libiberty has a use of atoi in cplus-dem.c that is harmless (it's only used on
a single-digit string) but pointless (C guarantees that the digit characters
have consecutive integer values so you can just subtract '0', and this
guarantee is already in C90).