Bitfield structs and suggestion
Nick B
nick.barbalich at gmail.com
Mon Dec 3 23:53:10 PST 2007
Richard Bradley wrote:
>> It's not a priority, it's something that could be added later without
>> breaking anything -- just syntactic sugar, really. We can try again
>> later <g>.
>
> Curious, Has there been any movement on this issue? Is there a less error-prone way to do this other then manual shifts and masks?
>
> I am looking to write an open-source generic library for hardware design, I thought D would make a much better base then C++. I'm a big fan of what I've seen so far. Sorry to say, but D can't be a serious low-level contender without bitfield support.
>
> I'm not talking about using it once or twice in a project, but thousands of structures for each project, and each structure having dozens of bitfields. Having to do masks and shifts just seems like a nightmare of bad code.
>
> I can't imagine my friends on the firmware side (or any low-level developer) wouldn't agree.
>
> Miles' idea of making D somehow order aware would be a huge win for this close-to-the-hardware stuff. Or even non-order aware bitfields at least isn't worse then what's allready out there.
>
> Comments, ideas welcome.
> Richard
>
>
Richard
Does this help at all ?
http://www.digitalmars.com/d/phobos/std_bitmanip.html
Nick B
More information about the Digitalmars-d
mailing list