Set null as function array parameter
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 12 09:02:19 PST 2015
On Mon, 12 Jan 2015 16:53:59 +0000
Oleg via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
> On Monday, 12 January 2015 at 16:44:42 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > nope, it means exactly what is written there. except that
> > dynamic array
> > is represented by struct like this:
> >
> > struct {
> > void *dataptr;
> > size_t itemCount;
> > }
> >
> > this is what D calls "dynamic array", and this is what passed
> > by value:
> > struct with two members. dynamic array contents are *not* a
> > part of
> > "dynamic array type".
> >
> > yes, this is confusing.
>
> Thank you.
be careful with chaning dynamic array length though. it won't be seen
outside of function, as Adam wrote. and it can cause some side-effects
like partially modifyed array (if you modified some array elements and
then changes length, which causes reallocing).
-------------- 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-learn/attachments/20150112/1a7b45dd/attachment.sig>
More information about the Digitalmars-d-learn
mailing list