From owner-cvs-all Mon Feb 4 8:56:32 2002 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id DB70E37B405; Mon, 4 Feb 2002 08:56:11 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id DAA25685; Tue, 5 Feb 2002 03:55:04 +1100 Date: Tue, 5 Feb 2002 03:57:27 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mark Murray Cc: , Subject: Re: cvs commit: src/sys/sys socket.h types.h In-Reply-To: <200202041616.g14GG7E56111@greenpeace.grondar.org> Message-ID: <20020205034456.K23699-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 4 Feb 2002, Mark Murray wrote: > > > So how does one write a (decent) macro to return a correct value > > > for min(1u, -1)? > > The warnings are probably correct. They probably indicate that callers > > are passing mismatched arg types. > > Your thoughts on turning howmany() into a function? Negative. I gave the examples of the min() functions vs the MIN() macro to show why the macro is better. > > Perhaps more seriously, the change to the type of NBBY exposes an old > > bug in ffs and causes kernel panics. See another thread. Please > > back it out too, and consider doing the same for all the other type > > changes. > > If that is a bug, then surely that is what needs fixing? That and millions of other lines out there that may depend on the old behaviour. Anyway, I now think it is just wrong for NBBY to have an unsigned type. It is usually wrong for small counters to have an unsigned type just because they are nonnegative and represent counts. Unsigned types tend to cause sign extension problems and they always inhibit detection of overflow. NBBY is an old spelling of the standard CHAR_BIT. The type of CHAR_BIT is not specified in the standard, and is normally plain int. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message