On Fri, 26 Sep 2014 01:08:59 +0000
AsmMan via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com>
wrote:

> but null has length? what's null in D?
no, it's dynamic array that have `.length`. compiler magic. assigning
`null` to dynamic array variable does some magic under the hood.

dynamic array is actually this: `struct { size_t len; void* ptr};`.
when you assign `null` to dynamic array variable, compiler generates
code to clear both `len` and `ptr`. think about dynarray var as kind
of 'fat pointer', which compiler knows how to operate.

Attachment: signature.asc
Description: PGP signature

Reply via email to