From owner-freebsd-current Mon Mar 13 8:31:59 2000 Delivered-To: freebsd-current@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 84FAB37C0FD for ; Mon, 13 Mar 2000 08:31:55 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.3) with ESMTP id IAA10753; Mon, 13 Mar 2000 08:31:52 -0800 (PST) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id IAA52433; Mon, 13 Mar 2000 08:31:51 -0800 (PST) (envelope-from jdp@polstra.com) Date: Mon, 13 Mar 2000 08:31:51 -0800 (PST) Message-Id: <200003131631.IAA52433@vashon.polstra.com> To: bde@zeta.org.au Subject: Re: MAX_UID ? In-Reply-To: References: Organization: Polstra & Co., Seattle, WA Cc: current@freebsd.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article , Bruce Evans wrote: > > I would prefer standard maxof() and minof() interfaces that work on > any arithmetic type. These can almost be written in portable C, at > least in C89 where types are restricted to char, signed char, ..., > long double: > > #define isfloat(type) ((type)0.5 != 0) > #define issigned(type) ((type)-1 < 0) > #define isschar(type) (!isfloat(type) && issigned(type) && sizeof(type) == 1) > #define isuchar(type) (!isfloat(type) && !issigned(type) && sizeof(type) == 1) > ... > #define maxof(type) ((type)(isschar(type) ? SCHAR_MAX : > isuchar(type) ? UCHAR_MAX ...)) I like this idea. John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message