From owner-freebsd-hackers Mon May 14 23:49:11 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from segfault.kiev.ua (segfault.kiev.ua [193.193.193.4]) by hub.freebsd.org (Postfix) with ESMTP id DF40A37B422; Mon, 14 May 2001 23:49:03 -0700 (PDT) (envelope-from netch@iv.nn.kiev.ua) Received: (from uucp@localhost) by segfault.kiev.ua (8) with UUCP id JSU10097; Tue, 15 May 2001 09:48:49 +0300 (EEST) (envelope-from netch@iv.nn.kiev.ua) Received: (from netch@localhost) by iv.nn.kiev.ua (8.11.3/8.11.3) id f4F6kG302206; Tue, 15 May 2001 09:46:16 +0300 (EEST) (envelope-from netch) Date: Tue, 15 May 2001 09:46:16 +0300 From: Valentin Nechayev To: Dima Dorfman Cc: hackers@FreeBSD.ORG, bde@FreeBSD.ORG Subject: Re: MIN()/MAX() definitions in sys/param.h Message-ID: <20010515094616.B1835@iv.nn.kiev.ua> References: <20010514071731.1D9F93E28@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010514071731.1D9F93E28@bazooka.unixfreak.org>; from dima@unixfreak.org on Mon, May 14, 2001 at 12:17:31AM -0700 X-42: On Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mon, May 14, 2001 at 00:17:31, dima (Dima Dorfman) wrote about "MIN()/MAX() definitions in sys/param.h": > Is there a reason the definitions of the MIN() and MAX() macros in > sys/param.h are under an '#ifndef _KERNEL'? Quite a few files in the > kernel define these (well, at least MIN) themselves, so it would seem > to make sense to define them globally in sys/param.h for the kernel as > well. Any reason this isn't already done this way, or should I come > up with a patch to fix that? gcc provides safe way to implement min()/max(): === cut from info gcc === #define max(a,b) \ ({typedef _ta = (a), _tb = (b); \ _ta _a = (a); _tb _b = (b); \ _a > _b ? _a : _b; }) === end cut === For kernel compiling you may rely on gcc and use such safe macros. I'm unsure for the same statement about userland. /netch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message