LDC 0.13.0 alpha 2 released! Please help test!
bearophile
bearophileHUGS at lycos.com
Mon Apr 14 02:13:29 PDT 2014
Kai Nacke:
> I identified the problem. The program declares a static array
> with zero elements.
Yes, recently zero-length arrays were improved in DMD right to
allow that better kind of usage in variable length structs. Past
versions (visible in the Revision History in that Rosettacode
site) used more awkward code, like:
(cast(CellIndex*)&state.c_)[i] = x;
because until recently the .ptr field of a zero length array was
null. Recently this was fixed and now it's not null any more. It
returns the start address. So you can use (you still need to use
.ptr because the length is zero):
c_.ptr[i] = x;
Bye,
bearophile
More information about the digitalmars-d-ldc
mailing list