[Mono-list] Dynamic Arrays and Bounds Check

Cauê Waneck waneck at gmail.com
Sun Jan 23 16:49:40 EST 2011


I'm implementing a dynamic array on top of System.Array, and I'd like to
know if there is any way to loop through all elements of the dynamic array
without having to bounds-check on each access to it.
I see on the docs that if I use a for with the variable being tested to be
less than array.Length, it will optimize away the bounds check, but in the
case of the dynamic array, I don't want to iterate over the underlying fixed
array, but I want to iterate over my array's length (which is always, of
course, smaller than the array's length).

Is there any way (with safe code) to be able to drop the bounds check? Also
is there any way to know if the bounds check was dropped?


THank you!!!
Cauê
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20110123/7db2d7dd/attachment.html 


More information about the Mono-list mailing list