|
|
| XP is just a number | |
| PerlMonks |
japhy looks at av.c (not av.h)by japhy (Canon) |
| on Nov 20, 2000 at 00:46 UTC ( #42437=note: print w/ replies, xml ) | Need Help?? |
|
UPDATEAs per my revelations in sort this data, here is a bit of an adjusted report on the av.c source.Here's the relevant portion from av.c in the 5.6 source: Ok, so unshift() has to do a lot of sliding the elements up if there's not already some free space generated by a call to shift(). What shift() does is simply slide the pointer up one notch, which is very fast (which provides free space for unshift() later). It stores the value in *AvARRAY(av) into retval, and then sets *AvARRAY(av) to the C equivalent of Perl's undef value. Then it moves the pointer that marks the beginning of the array to AvARRAY(av) + 1. It also subtracts one from the max subscript and the length of the array. Then it returns retval. <revelation>I'm beginning to grok the source code! Look out!</revelation>. japhy -- Perl and Regex Hacker
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||