grauzone wrote: > Daniel Keep wrote: >> >> nobody wrote: >>> == Quote from Brad Roberts ([email protected])'s article >>>> The auto-generated code from the library is the same code the compiler >>>> would end up generating. You can test that theory by comparing the >>>> produced assembly for a C vs a D implementation. >>> If the generated code are same, and it's in the std library, which >>> means no >>> difference in the backend. >>> >>> Then I'd rather write: >>> >>> struct A >>> { >>> bool flag1: 1; >>> bool flag2: 1; >>> // uint "", 6; // this should be auto-magically generated >>> by the compiler >>> } >>> >>> (the code is more clear, and the compiler can give better message). >>> >>> than this: >>> >>> struct A >>> { >>> mixin(bitfields!( >>> bool, "flag1", 1, >>> bool, "flag2", 1, >>> uint, "", 6)); >>> } >> >> Except that bitfields don't appear to be a widely used feature. If you >> can put it in the library with no performance penalty AND simplify the >> compiler at the same time, that looks like a good thing to me, and I >> believe Walter agrees. > > Yeah, let's move everything from the compiler to the library. Damn, why > couldn't they have const implemented as library feature? > >> -- Daniel
Except that bitfields don't appear to be a widely used feature. -- Daniel
