[Submission] D Slices
David Nadlinger
see at klickverbot.at
Sat Jun 11 09:48:49 PDT 2011
On 6/11/11 6:08 PM, eles wrote:
> well, on unsigned nbits=3, UTYPE_MAX =7 and that's a valid index, as
> you write a[0]..a[7]. the array has UTYPE_MAX+1 elements (ie.
> "length", aka "$") and this is exactly why mentioning "$" as "length"
> instead of "last element" is inconsistent when you write a[0..$] (the
> second index is, *with this syntax* UTPE_MAX+1 and is not
> representable)
As Steve said, this »problem« occurs only when your array length is
larger than the address space.
I hereby challenge you to write some real-world D code and show me a
single instance where the open-right slicing syntax would be a problem
in this regard – personally, I didn't encounter one yet after writing
several tens of thousands of lines of D code.
David
More information about the Digitalmars-d
mailing list