[Issue 4425] New: More bells & whistles for bitfields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 4 12:39:36 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4425

           Summary: More bells & whistles for bitfields
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-07-04 12:39:29 PDT ---
When bit fields are used to define bit protocols etc., they sometimes have
constant fields, or already initialized variable fields. So It can be positive
for std.bitmanip.bitfields to support that too, this is an example:

          field1 : 1;
          field2 : 2 = 0b01;
immutable field3 : 3;
immutable field4 : 4 = 0b1110;


As with normal immutable fields in structs, the language has to forbid the
write on immutable fields. Probably in many cases the compiler can't enforce
this at compile time on bit fields (because of the type system granularity;
something similar happens with pointers to single bits in bit-arrays), so
probably the bit field immutability needs to be enforced at run-time (maybe
even in release mode too, because it's a hard constraint).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list