summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-08-28 21:18:41 -0600
committerKarl Williamson <khw@cpan.org>2020-09-13 21:13:58 -0600
commita56541ebc9ed6b2a0b96118b9e7fa5d769cb2762 (patch)
tree9a6027ce927d2a878c6f780307f018de4ab3b200
parente572b3be45c78860f5e245874dc47d4ba6fe9cce (diff)
downloadperl-a56541ebc9ed6b2a0b96118b9e7fa5d769cb2762.tar.gz
Document AvFILLp; clarify related entries
-rw-r--r--av.c17
-rw-r--r--av.h11
2 files changed, 17 insertions, 11 deletions
diff --git a/av.c b/av.c
index 6fc129471a..ada09cde9a 100644
--- a/av.c
+++ b/av.c
@@ -802,19 +802,24 @@ Perl_av_shift(pTHX_ AV *av)
}
/*
-=for apidoc av_top_index
+=for apidoc av_tindex
+=for apidoc_item av_top_index
-Returns the highest index in the array. The number of elements in the
-array is S<C<av_top_index(av) + 1>>. Returns -1 if the array is empty.
+These behave identically.
+If the array C<av> is empty, these return -1; otherwise they return the maximum
+value of the indices of all the array elements which are currently defined in
+C<av>.
-The Perl equivalent for this is C<$#myarray>.
+They process 'get' magic.
-(A slightly shorter form is C<av_tindex>.)
+The Perl equivalent for these is C<$#av>.
+
+Use C<L</av_count>> to get the number of elements in an array.
=for apidoc av_len
Same as L</av_top_index>. Note that, unlike what the name implies, it returns
-the highest index in the array. This is unlike L</sv_len>, which returns what
+the maximum index in the array. This is unlike L</sv_len>, which returns what
you would expect.
B<To get the true number of elements in the array, instead use C<L</av_count>>>.
diff --git a/av.h b/av.h
index d7281e8cb8..56e22818bf 100644
--- a/av.h
+++ b/av.h
@@ -44,13 +44,14 @@ Null AV pointer.
(deprecated - use C<(AV *)NULL> instead)
-=for apidoc Am|int|AvFILL|AV* av
-Same as C<av_top_index()> or C<av_tindex()>.
+=for apidoc Am|SSize_t|AvFILL|AV* av
+Same as C<L</av_top_index>> or C<L</av_tindex>>.
-=for apidoc av_tindex
-Same as C<av_top_index()>.
+=for apidoc Cm|SSize_t|AvFILLp|AV* av
-=for apidoc m|int|AvFILLp|AV* av
+If the array C<av> is empty, this returns -1; otherwise it returns the maximum
+value of the indices of all the array elements which are currently defined in
+C<av>. It does not handle magic, hence the C<p> private indication in its name.
=cut
*/