Zero-length static array spec

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 10:09:34 PST 2015


On 2/6/15 11:15 AM, David Nadlinger wrote:
> On Monday, 2 February 2015 at 14:32:16 UTC, Steven Schveighoffer wrote:
>> The lynch pin here is that "it's useful as the last member of a
>> variable length struct." If it's given the address of 0, then it's no
>> longer useful there, so it should take an address of where it is defined.
>
> This use case (i.e. as part of a bigger aggregate) already works in LDC.
>
> The issue is specific to zero-size stack allocations. Last time I
> checked it wasn't possible to do this with LLVM in a sensible way
> without allocating a non-zero amount of memory. In contrast to the
> current behavior, this would actually violate the spec as it is worded now.

What about a closure? Isn't that a struct allocated on the heap?

-Steve


More information about the Digitalmars-d mailing list