On Friday, 30 July 2021 at 14:05:58 UTC, workman wrote:
I get want to define this struct in D:

```c
struct test1 {
    struct test1 *prev;
    struct test1 *next;
    size_t v1;
    size_t v2;
    size_t v3;
    char data[];
};
```

```d
struct test1 {
    test1 *prev;
    test1 *next;
    size_t v1;
    size_t v2;
    size_t v3;
    char* data;
};
```

when I compare the size, test1.sizeof is 48 and sizeof(struct test1) from C is 40.

Anyone can explain what should I do with this ?

If I use test1 as member of other struct, the total size will not match.


```d
struct test1 {
    test1 *prev;
    test1 *next;
    size_t v1;
    size_t v2;
    size_t v3;
    char[0] data;
}
```

data.ptr to access its pointer

Reply via email to