proper bit fields in the D2 language?
nobody
hehe at hehe.com
Tue Apr 21 22:41:47 PDT 2009
== Quote from Brad Roberts (braddr at puremagic.com)'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));
}
More information about the Digitalmars-d
mailing list