SET, CLR, ISSET in types.h for _KERNEL builds

Andrew Reilly andrew-freebsd at areilly.bpc-users.org
Wed Jun 28 10:33:01 UTC 2006


On Wed, Jun 28, 2006 at 09:53:46AM +0000, Poul-Henning Kamp wrote:
> In message <20060628094221.GA50978 at comp.chem.msu.su>, Yar Tikhiy writes:
> >On Tue, Jun 27, 2006 at 01:58:17PM -0600, M. Warner Losh wrote:
> 
> >> NetBSD recently added SET, CLR, ISSET to sys/types.h (only if _KERNEL
> >> is defined).
> 
> As one of the people who have worked with the original /bin/sh source
> code, I have a slight alergic reaction to attempts to paste over
> the implementation language with macros like these.
> 
> Setting a bit in 'C' is spelled 
> 	variable |= bit;
> not
> 	SET(variable, bit);

To my eye, if you're going to use "bit" to describe which bit is
being operated on, then you should *really* be doing:
	variable |= (1 << bit)
and, obviously, SET(variable, bit) should do that, rather than
what has been proposed.

What you're spelling, above, and what the NetBSD macros that
Warner described do are actually doing:
	SET(variable, mask).

Compatability is a good thing, and if it's convenient to have
NetBSD compatability macros, then go do it, but I think that
it's important that they advertise what they're doing correctly.

(Like the colour now?)

Cheers,

-- 
Andrew


More information about the freebsd-arch mailing list