Skip to content

Index and Range should accept negative values, as well. #84531

Closed Answered by tannergooding
ernest-morariu asked this question in General
Discussion options

You must be logged in to vote

I am trying to say that I don't see the big impact you talk about. It's true that the existing .net API that currently accepts Indexes and Ranges will probably need to validate against negative values and this is probably the big impact you talk about.

Index is internally a single int field today. It supports indices from the start of the collection which are internally represented as 0 to +2147483647, inclusive. It then supports indices from the end of the collection which are internally represented as -1 to -2147483648, inclusive.

Thus, the bits that would be used to represent negative indices are "already taken" in order to efficiently support "from end of the collection". In order t…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@tannergooding
Comment options

@ernest-morariu
Comment options

@tannergooding
Comment options

Answer selected by ernest-morariu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants