Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

list_set_length

3 views
Skip to first unread message

Karl Forner

unread,
Feb 20, 2006, 7:14:15 PM2/20/06
to perl6-i...@perl.org
I apologize for my probably naive question...

Trying to decipher t/pmc/array.t, I began wondering what happens if you set
a negative length to an array.
It lead me to array.pmc::set_integer_native, which just forwards its size
argument to list.c::list_set_length
without any check.


list_set_length() seems to accept negative sizes. The implemented behaviour
seems to decrease the size
of the array by the absolute value of the arg, iff it is >= 0.

For instance, if an array of size 5 is set to -10, it will have no effect.

So my question is :
- Is it expected (in List API, in PMC Array) ?
- Where can I find the specification/documentation describing this kind of
behaviour ?

Thanks

Karl

0 new messages