need help to get bitoffsetof bitwidth for clang

Dakota dakota at gmail.com
Tue Jul 2 05:34:19 UTC 2024


I want to get `bitoffsetof` and `bitwidth` in clang, to verify 
the d memory layout.

I try this but not work:

```c
#define offsetof_bit(type, member) ((offsetof(type, member) * 8) 
+ __builtin_ctz(((type *)0)->member))
```


get this error:

```sh
cannot compute offset of bit-field 'field'
```




More information about the Digitalmars-d-learn mailing list