Change representation of dynamic arrays?

Janice Caron caron800 at googlemail.com
Sat Oct 20 03:57:13 PDT 2007


On 10/20/07, Jascha Wetzel <firstname at mainia.de> wrote:
> Walter Bright wrote:
> > Janice Caron wrote:
> >> That said, someone posted that you always allocate an extra byte. If
> >> that's true, problem solved.
> >
> > Yes, an extra byte is allocated for just this reason.
>
> couldn't the end pointer just point to the last element?

Oooh yuk. How horrible. I'd rather that didn't happen. For one thing,
it means that empty arrays (and empty collection ranges generally)
would have to have a different representation.

No, I like the "standard" way of doing things, whereby the end
iterator refences the last+1 element (and therefore cannot be
dereferenced).



More information about the Digitalmars-d mailing list