SDX2000/Deimos — Issue #1: Modify the DMD D compiler to support bit fields
Author: SDX2000
Created: 2012-01-01 06:42:08+00:00
State: open

# Description

As of now the D language does not have native support for C style bit fields. [This](http://www.d-programming-language.org/phobos/std_bitmanip.html) is the recommended approach of addressing this issue. However IMHO native support for bit fields will go a long way in establishing D as a programming language suitable for use in low level environments (like OS / Embedded systems etc work).

# Design notes
1. Some [restrictions](http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=%2Fcom.ibm.vacpp6m.doc%2Flanguage%2Fref%2Fclrc03defbitf.htm) worth considering

2. [Endianness](http://www.digitalmars.com/d/archives/9782.html) considerations.

3. Using bit fields should be as efficient as using masks and shifts. Investigate and try to find cases where this is not possible and provide a best effort solution.

4. Will it be better to forego the C approach all together and provide (signed/unsigned) integral types for any size instead of trying to divide known integers into fractional units.?
- Alignment, padding etc should be user configurable in this case.