This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Advertise grok_atou.
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 21 Jul 2014 14:56:49 +0000 (10:56 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 23 Jul 2014 01:31:42 +0000 (21:31 -0400)
pod/perlclib.pod
pod/perlhacktips.pod

index 23cca04..b7d8c10 100644 (file)
@@ -200,7 +200,8 @@ C<toUPPER_uni>, as described in L<perlapi/Character case changing>.)
  Instead Of:                 Use:
 
  atof(s)                     Atof(s)
- atol(s)                     Atol(s)
+ atoi(s)                     grok_atou(s, &e)
+ atol(s)                     grok_atou(s, &e)
  strtod(s, &p)               Nothing.  Just don't use it.
  strtol(s, &p, n)            Strtol(s, &p, n)
  strtoul(s, &p, n)           Strtoul(s, &p, n)
index c673dde..1d8aa19 100644 (file)
@@ -623,6 +623,14 @@ of the program is UTF-8.  What happens is that the C<%s> and its operand are
 simply skipped without any notice.
 L<https://sourceware.org/bugzilla/show_bug.cgi?id=6530>.
 
+=item *
+
+Do not use atoi()
+
+Use grok_atou() instead.  atoi() has ill-defined behavior on overflows,
+and cannot be used for incremental parsing.  It is also affected by locale,
+which can be construed as a bug.
+
 =back
 
 =head1 DEBUGGING