Implicit enum conversions are a stupid PITA

Walter Bright newshound1 at digitalmars.com
Wed Mar 24 21:48:00 PDT 2010


Nick Sabalausky wrote:
> Custom bitfields are extremely useful for low-level code. Being a 
> self-proclaimed "systems" language, there's no reason D should consider such 
> a thing to be of "narrow-usefulness".

I've written a lot of low-level code, I even programmed Mattel Intellivision 
cartridges and one of those old 70's hand-held LED games (Mattel Soccer). I've 
done a lot of embedded 6800 microprocessor work, device drivers, graphics 
drivers, etc. I've done a lot of bit twiddling code.

But I find C bit fields to be generally worthless.

One reason is the standard requires them to be right justified after extraction. 
This kills performance. I muck with with them in-place using biased arithmetic.



More information about the Digitalmars-d mailing list