translate C struct char array into D

workman workman at gmail.com
Fri Jul 30 14:05:58 UTC 2021


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.



More information about the Digitalmars-d-learn mailing list