Date: Wed, 28 Jun 2006 20:08:24 +1000 From: Andrew Reilly <andrew-freebsd@areilly.bpc-users.org> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: Yar Tikhiy <yar@comp.chem.msu.su>, arch@freebsd.org Subject: Re: SET, CLR, ISSET in types.h for _KERNEL builds Message-ID: <20060628100824.GA1326@duncan.reilly.home> In-Reply-To: <75461.1151488426@critter.freebsd.dk> References: <20060628094221.GA50978@comp.chem.msu.su> <75461.1151488426@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 28, 2006 at 09:53:46AM +0000, Poul-Henning Kamp wrote: > In message <20060628094221.GA50978@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060628100824.GA1326>