summaryrefslogtreecommitdiff
path: root/pod/perlclib.pod
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-07-21 15:15:42 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-07-22 21:31:42 -0400
commit338aa8b061f430c2b3d9deaeed0aec523639aff7 (patch)
tree701139243fc4530fa33e0e4e53bbf5d4d6005632 /pod/perlclib.pod
parent999448781bc711c8732271b98a45a724f7357c46 (diff)
downloadperl-338aa8b061f430c2b3d9deaeed0aec523639aff7.tar.gz
Document grok_atou as strtoul replacement.
Diffstat (limited to 'pod/perlclib.pod')
-rw-r--r--pod/perlclib.pod11
1 files changed, 8 insertions, 3 deletions
diff --git a/pod/perlclib.pod b/pod/perlclib.pod
index b7d8c10861..b4ebe4e194 100644
--- a/pod/perlclib.pod
+++ b/pod/perlclib.pod
@@ -203,12 +203,17 @@ C<toUPPER_uni>, as described in L<perlapi/Character case changing>.)
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)
+ strtol(s, &p, n) grok_atou(s, &e)
+ strtoul(s, &p, n) grok_atou(s, &e)
Notice also the C<grok_bin>, C<grok_hex>, and C<grok_oct> functions in
F<numeric.c> for converting strings representing numbers in the respective
-bases into C<NV>s.
+bases into C<NV>s. Note that grok_atou() doesn't handle negative inputs,
+or leading whitespace (being purposefully strict). It also doesn't always
+handle full IV/UV-range, being limited to Size_t.
+
+Note that strtol() and strtoul() may be disguised as Strtol(), Strtoul(),
+Atol(), Atoul(). Avoid those, too.
In theory C<Strtol> and C<Strtoul> may not be defined if the machine perl is
built on doesn't actually have strtol and strtoul. But as those 2