[dmd-internals] Modifying the dmd compiler to add support for bitfields

Walter Bright walter at digitalmars.com
Sun Jan 8 12:53:58 PST 2012


Bit fields are already done in D using a library solution:

http://d.digitalmars.com/2.0/phobos/std_bitmanip.html

On 1/8/2012 7:49 AM, Sandeep Datta wrote:
> [Cross post from the D news group]
>
> Hi All,
>
> To gain a better understanding of how the D compiler works I am
> trying to implement support for bit fields in structures. I have
> modified the parser code to admit the following syntax (for now)...
>
> struct A{
>     uint:8 a;
>     uint:5 b;
>     uint:* unused; //Takes up the remaining space.
>     //Raise an error when the computed size is zero.
> }
>
> You can see my changes here...https://github.com/SDX2000/dmd
>
> I have been trying to work out a strategy for modifying the compiler
> code generation for quite some time now but haven't been able to
> make much headway in this direction.
>
> I would appreciate any help at this point.
>
> Regards,
> Sandeep Datta.
>
>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20120108/7fa640a4/attachment.html>


More information about the dmd-internals mailing list