Working on a library: request for code review

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 17 06:07:32 PDT 2014


On Monday, 16 June 2014 at 23:04:33 UTC, Rene Zwanenburg wrote:
> This one depends on taste, but these helpers can be eliminated 
> by changing the Header definition a little. It's the same union 
> / anonymous struct trick from the previous post, only this time 
> with bitfields:
>
> http://dpaste.dzfl.pl/13258b0ce0c4

If you define nested structs/unions, it's better to make them 
static whenever possible, because non-static nested structs have 
an additional hidden field for the context.

Also, when you work with bit-(un)packing, you need to make sure 
it works on big- and little-endian CPUs.


More information about the Digitalmars-d-learn mailing list