digitalmars.D - Bit fields in struct, why doesn't D support them?
- Jeremie Pelletier (2/2) May 19 2009 I know this is an old subject, as this has been stated in the struct ref...
- Jarrett Billingsley (3/5) May 19 2009 It actually wouldn't, since C doesn't specify any order to packing
- Lutger (2/5) May 19 2009 In D2 it is supported by phobos: http://www.digitalmars.com/d/2.0/phobos...
- Brad Roberts (6/9) May 19 2009 Google is your friend. This thread has happened at least once in the pa...
I know this is an old subject, as this has been stated in the struct reference page ever since D1, but I'm really wondering why the bit fields aren't supported (or purposely not implemented?) in D. Having this feature would greatly simplify a lot of code, and allow easier interfacing with C structs using it.
May 19 2009
On Tue, May 19, 2009 at 11:17 PM, Jeremie Pelletier <jeremiep gmail.com> wrote:I know this is an old subject, as this has been stated in the struct reference page ever since D1, but I'm really wondering why the bit fields aren't supported (or purposely not implemented?) in D. Having this feature would greatly simplify a lot of code, and allow easier interfacing with C structs using it.It actually wouldn't, since C doesn't specify any order to packing bitfields, whether there should be padding etc.
May 19 2009
Jeremie Pelletier wrote:I know this is an old subject, as this has been stated in the struct reference page ever since D1, but I'm really wondering why the bit fields aren't supported (or purposely not implemented?) in D. Having this feature would greatly simplify a lot of code, and allow easier interfacing with C structs using it.In D2 it is supported by phobos: http://www.digitalmars.com/d/2.0/phobos/std_bitmanip.html
May 19 2009
Jeremie Pelletier wrote:I know this is an old subject, as this has been stated in the struct reference page ever since D1, but I'm really wondering why the bit fields aren't supported (or purposely not implemented?) in D. Having this feature would greatly simplify a lot of code, and allow easier interfacing with C structs using it.Google is your friend. This thread has happened at least once in the past already. Before rehashing it, might as well catch up on the past discussion: http://www.digitalmars.com/d/archives/digitalmars/D/proper_bit_fields_in_the_D2_language_88506.html Later, Brad
May 19 2009