On Friday, 30 July 2021 at 14:40:17 UTC, Paul Backus wrote:
On Friday, 30 July 2021 at 14:05:58 UTC, workman wrote:
[...]
`char data[]` in the C struct is not a pointer, but actually a
[C99 flexible array member][1], and does not count towards the
struct's `sizeof`.
D does not have flexible array members, but you can simulate
one using a struct method:
```d
struct test1 {
// member variables...
char* data() {
return cast(char*) (&this + 1);
}
}
```
[1]: http://port70.net/~nsz/c/c99/n1256.html#6.7.2.1p16
B-but the performance penalty of having an extra level of
indirection? Absolutely unacceptable!!