need help to translate C into D

Dennis dkorpel at gmail.com
Tue Sep 13 09:57:38 UTC 2022


On Tuesday, 13 September 2022 at 09:43:46 UTC, test123 wrote:
> This will not work since the C have no array like D.

You can use a 0-size static array:
```D
struct mystruct {
	uint32_t mask_limit;   // Limit enum value that can be tested 
with mask.
	uint32_t value_count;  // Number of values after the bitfield.
	uint32_t[0] data;      // Bitmask + enumerated values follow.
}
```

Then you have to index with `mystructVar.data.ptr[i]` to avoid 
bounds checking.


More information about the Digitalmars-d-learn mailing list