Hi Walter,<div><br></div><div>Thanks for the reply. I am aware of the mixin based solution but the main motivation for me at this point is getting to know the D compiler well. And IMHO native support for bitfields will be a welcome new change. I am trying to write an OS/kernel (<a href="https://github.com/SDX2000/Deimos">https://github.com/SDX2000/Deimos</a>) in D and as far as machine hugging code is concerned bitfields and unions are a mainstay. The mixin syntax looks jarring and alien. Please see <a href="https://github.com/SDX2000/Deimos/issues/1">https://github.com/SDX2000/Deimos/issues/1</a> for what I am trying to accomplish.</div>
<div><br></div><div>I am particularly curious about the dt_t data structure you seem to be using how does this work? </div><div><br></div><div>Regards,</div><div>Sandeep Datta.</div><div><br><div class="gmail_quote">On Mon, Jan 9, 2012 at 5:53 AM, Walter Bright <span dir="ltr"><<a href="mailto:walter@digitalmars.com" target="_blank">walter@digitalmars.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div bgcolor="#ffffff" text="#000000">
Bit fields are already done in D using a library solution:<br>
<br>
<a href="http://d.digitalmars.com/2.0/phobos/std_bitmanip.html" target="_blank">http://d.digitalmars.com/2.0/phobos/std_bitmanip.html</a><div><div><br>
<br>
On 1/8/2012 7:49 AM, Sandeep Datta wrote:
</div></div><blockquote type="cite"><div><div>
<div>[Cross post from the D news group]</div>
<div><br>
</div>
<div>Hi All,</div>
<div><br>
</div>
<div>To gain a better understanding of how the D compiler works I
am</div>
<div>trying to implement support for bit fields in structures. I
have</div>
<div>modified the parser code to admit the following syntax (for
now)...</div>
<div><br>
</div>
<div>struct A{</div>
<div> uint:8 a;</div>
<div> uint:5 b;</div>
<div> uint:* unused; //Takes up the remaining space.</div>
<div> //Raise an error when the computed size is zero.</div>
<div>}</div>
<div><br>
</div>
<div>You can see my changes here...<a href="https://github.com/SDX2000/dmd" target="_blank">https://github.com/SDX2000/dmd</a></div>
<div><br>
</div>
<div>I have been trying to work out a strategy for modifying the
compiler</div>
<div>code generation for quite some time now but haven't been able
to</div>
<div>make much headway in this direction.</div>
<div><br>
</div>
<div>
I would appreciate any help at this point.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Sandeep Datta.</div>
<div><br>
</div>
</div></div><pre><fieldset></fieldset>
_______________________________________________
dmd-internals mailing list
<a href="mailto:dmd-internals@puremagic.com" target="_blank">dmd-internals@puremagic.com</a>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-internals" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a></pre>
</blockquote>
</div>
<br>_______________________________________________<br>
dmd-internals mailing list<br>
<a href="mailto:dmd-internals@puremagic.com" target="_blank">dmd-internals@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-internals" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a><br></blockquote></div><br></div>