Re: need help to get bitoffsetof bitwidth for clang

2024-07-04 Thread Dakota via Digitalmars-d-learn
On Wednesday, 3 July 2024 at 21:47:32 UTC, Tim wrote: If you only want to see the layout, you can use the following command to dump it: ``` clang test.c -Xclang -fdump-record-layouts -c ``` File test.c could contain the following: ``` struct S { int a : 3; int b : 29; }; struct S dummy;

Re: need help to get bitoffsetof bitwidth for clang

2024-07-03 Thread Tim via Digitalmars-d-learn
On Tuesday, 2 July 2024 at 05:34:19 UTC, Dakota wrote: 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