From owner-cvs-all Mon Feb 4 10:55:44 2002 Delivered-To: cvs-all@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id 5ACA737B428; Mon, 4 Feb 2002 10:55:19 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g14ItHJ53592; Mon, 4 Feb 2002 18:55:17 GMT (envelope-from mark@grondar.za) Received: from greenpeace.grondar.org (greenpeace [192.168.42.2]) by gratis.grondar.org (Postfix) with ESMTP id 3D5F3382; Mon, 4 Feb 2002 18:50:26 +0000 (GMT) Received: from grondar.za (localhost [127.0.0.1]) by greenpeace.grondar.org (8.11.6/8.11.6) with ESMTP id g14HK9E56882; Mon, 4 Feb 2002 17:20:09 GMT (envelope-from mark@grondar.za) Message-Id: <200202041720.g14HK9E56882@greenpeace.grondar.org> To: Bruce Evans Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys socket.h types.h References: <20020205034456.K23699-100000@gamplex.bde.org> In-Reply-To: <20020205034456.K23699-100000@gamplex.bde.org> ; from Bruce Evans "Tue, 05 Feb 2002 03:57:27 +1100." Date: Mon, 04 Feb 2002 17:20:04 +0000 From: Mark Murray 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. Hehehe! I read that as a reason why the function is better, as it (seemed to?) allowed more sane type-correct handling. > > > 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. A quick grep shows that that may just be a bit pessimistic :-). The kernel currently has 19 files containing NBBY. 7 of them are headers, and looking at them shows that fixing NBBY use in macros is close to trivial. > 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. OK. NBBY is now back to signed. I'll look for other fixes for the lint whinings :-). M -- o Mark Murray \_ FreeBSD Services Limited O.\_ Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message