[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Treatment of negative index to select()
- From: Doug Rogers <douglua@...>
- Date: Sun, 07 Mar 2010 13:03:50 -0500
Since 5.2 is still undergoing change, I'm wondering if the authors would
consider changing the (not well documented) behavior of select() for
The manual  states that select returns all arguments above the first
index, but doesn't say that negative arguments are treated in any
special way. The actual behavior in 5.1.4 is similar to that of string
indexing, which I can certainly understand.
But some interesting and useful behaviors can be supported if select()
were allowed to return the arguments up to the absolute value of the
index when the index is negative. Or perhaps some other means could be
provided to select the first n items.
See . That message is long, inviting a cold reception, but it does
have the advantage of putting everything in one place! FYI, the patch is
Regardless, there seems to be an inconsistency in handling overflow of a
numeric argument. An index which is too large is accepted as referring
to the last element whereas an index that is too small (too negative) is
rejected rather than being accepted as the first element.