-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
There's an interesting issue with languages that have usize, in that you can never convert between an int and a usize without risking an overflow. How can we avoid this?
An interesting observation is that Java does not have this problem. In fact, Java limited array indices to int types (i.e. 32bit) which does indeed limit the maximum size of an array.
One option is to allow the user to specify this. For example, T[u32] indicates an array of type T with indices of type u32. That means the array has a maximum size limit, but also means we can read indices into u32 without risk of coercion failures.
Metadata
Metadata
Assignees
Labels
No labels