On 1 February 2015 at 14:42, Stefan Frijters via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > > Static Arrays > int[3] s; > These are analogous to C arrays. Static arrays are distinguished by having a > length fixed at compile time. > > The total size of a static array cannot exceed 16Mb. A dynamic array should > be used instead for such large arrays. > > A static array with a dimension of 0 is allowed, but no space is allocated > for it. It's useful as the last member of a variable length struct, or as > the degenerate case of a template expansion. > > Static arrays are value types. Unlike in C and D version 1, static arrays > are passed to functions by value. Static arrays can also be returned by > functions. > > --- > > It does not seem to say whether a zero-length array should have a valid > address or not. > > Thoughts? >
Regardless of size, a static array should always have an address on the stack. Of course, dereferencing said address is undefined. You can also consider it a require that although a zero-length static array may have an address, it doesn't take up any space either. Consider: int[0] data0; int[1] data1; Here, you could expect both data0 and data1 to have the same .ptr address, but data0.ptr == data1.ptr should not succeed either.