develooper Front page | perl.perl5.porters | Postings from April 2013

[perl #117729] "splice() offset past end of array" warning doesn't always appear

Thread Next
From:
Karen Etheridge
Date:
April 25, 2013 03:41
Subject:
[perl #117729] "splice() offset past end of array" warning doesn't always appear
Message ID:
rt-3.6.HEAD-28177-1366748042-489.117729-75-0@perl.org
# New Ticket Created by  Karen Etheridge 
# Please include the string:  [perl #117729]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117729 >



According to the splice documentation in perlfunc:

   splice ARRAY or EXPR,OFFSET

   If OFFSET is past the end of the array, Perl issues a warning, and
   splices at the end of the array.

Consider:
    perl -wle'use warnings FATAL => "all"; my @arr = qw(0 .. 10); splice(@arr, 20); print "ar is @arr"'

This generates a warning on some versions/architectures and not others.
Based on the versions tested, this appears to have regressed between 5.14.3
and 5.16.0.


warning:
5.8.9 darwin OSX 10.6.8
5.14.2 darwin OSX 10.6.8
5.14.3 darwin OSX 10.6.8
5.14.3 linux CentOS

no warning:
5.16.0 linux ubuntu
5.16.0 darwin OSX 10.6.8
5.16.1 darwin OSX 10.6.8
5.16.3 darwin OSX 10.6.8
5.17.11 darwin OSX 10.6.8


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About