Subject: Re: PROPOSAL: API for environmental sensors
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 11/21/1999 13:13:55
>>> ENVSYS_FCURVALID  0x00000002
>>> ENVSYS_FMINVALID  0x00000004
[...]
> I'm beginning to really detest the use of manually generated binary
> flags for purposes like this.

So generate them mechanically; I have a program "renumber" that's
specifically designed for producing the numbers for lists of #defines
like these, and it has a mode where it generates walking bits instead
of consecutive small integers.

> I'm beginning to find that one-bit bit-fields are much more elegant
> and make my code very easy to understand.

And they have plenty of problems of their own, most notably that they
make it impossible to manipulate more than one bit (or field, if you
use multi-bit fields) at a time.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B