bug in assigning to dynamic array element

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 1 05:04:00 PDT 2014


On Sat, 01 Nov 2014 11:55:53 +0000
anonymous via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On Saturday, 1 November 2014 at 11:50:34 UTC, ketmar via
> Digitalmars-d wrote:
> > this *IS* a bug. either compiler should error on this, or it 
> > shouldn't
> > modify random memory. imagine the situation when old array 
> > contents not
> > only collected by GC, but that memory was allocated to something
> > completely different.
> 
> The old array is still alive and kicking. The left-hand side
> still references it. It wasn't collected. You're not writing to
> random memory.
so it's not only writes to the stale copy, but protects that copy from
GC. what a great thing! and all this without even a small warning from
compiler. i can expect such behavior from c or c++ with all their UB,
but not from D. this is not only ugly, this is plainly wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141101/de29c517/attachment.sig>


More information about the Digitalmars-d mailing list