bug in assigning to dynamic array element

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


On Sat, 1 Nov 2014 12:34:50 +0000
Iain Buclaw via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On 1 November 2014 09:03, ketmar via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
> > Hello.
> >
> > let's run this code:
> >
> >       info.list[idx] = saveIt(info, count-1); //!!!
> 
> You could use:
> 
> emplace(&info.list[idx], saveIt(info, count-1));
i know some workarounds, i just want to know how can i explain this
nonsense to newcomers. "please, remember that you can't safely assign
values to array elements"? this is one of the best ways to turn 'em
off. "wut? are you kidding? that's what they call 'safe language'?
thank you, but no. they can't do even array assign, what a..." ;-)
-------------- 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/96e4f0f9/attachment-0001.sig>


More information about the Digitalmars-d mailing list