On Wed, 11 Jun 2008, Garrett D'Amore wrote:
> I recall when NetBSD added them about year or two ago. It isn't that
> clear to me that they serve that much use, or really help clear code up
> that much. But I'll defer to consensus.
In my current day job (writing code for embedded systems), I'm accessing
bits of registers quite frequently. I find macros like this very useful;
for example:
#define BITVALUE(bit) (1UL << (bit))
#define MY_MASK (BITVALUE (4))
is much more readable than
#define MY_MASK (1UL << 4)
And perhaps more meaningful than
#define MY_MASK (16)
--
Rich Teer, SCSA, SCNA, SCSECA
CEO,
My Online Home Inventory
URLs: http://www.rite-group.com/rich
http://www.linkedin.com/in/richteer
http://www.myonlinehomeinventory.com
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code