Why do bitfields throw exceptions instead of wrapping?

2012-02-29 Thread ixid
In C++ this works: struct test { unsigned int h : 2; }; int main() { test b; b.h = 0; for(int i = 0;i 10;i++) ++b.h; return 0; } In D this throws an exception as soon as it wraps: struct test { mixin(bitfields!(

Re: Why do bitfields throw exceptions instead of wrapping?

2012-02-29 Thread James Miller
On 1 March 2012 16:15, ixid nuacco...@gmail.com wrote: In C++ this works: struct test {        unsigned int h : 2; }; int main() {        test b;        b.h = 0;        for(int i = 0;i 10;i++)                ++b.h;        return 0; } In D this throws an exception as soon as it