Nonstandard GCC features

Kagamin spam at here.lot
Fri Nov 21 08:41:01 PST 2008


bearophile Wrote:

> Zero-length arrays are available in D, but the following code (used in C to define a struct with ane or two variable-length arrays) can't be used, because of array bound controls:
> struct iso_block_store {
>         atomic_t refcount;
>         size_t data_size;
>         quadlet_t data[0];
> };

I use something like this:

struct iso_block_store {
        atomic_t refcount;
        size_t data_size;
        private quadlet_t xdata[0];
        quadlet_t[] data()
        { return xdata.ptr[0..data_size]; }
};



More information about the Digitalmars-d mailing list