Google Groepen ondersteunt geen nieuwe Usenet-berichten of -abonnementen meer. Historische content blijft zichtbaar.

list_set_length

3 weergaven
Naar het eerste ongelezen bericht

Karl Forner

ongelezen,
20 feb 2006, 19:14:1520-02-2006
aan 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 nieuwe berichten