Date: Tue, 15 May 2001 09:46:16 +0300 From: Valentin Nechayev <netch@iv.nn.kiev.ua> To: Dima Dorfman <dima@unixfreak.org> Cc: hackers@FreeBSD.ORG, bde@FreeBSD.ORG Subject: Re: MIN()/MAX() definitions in sys/param.h Message-ID: <20010515094616.B1835@iv.nn.kiev.ua> In-Reply-To: <20010514071731.1D9F93E28@bazooka.unixfreak.org>; from dima@unixfreak.org on Mon, May 14, 2001 at 12:17:31AM -0700 References: <20010514071731.1D9F93E28@bazooka.unixfreak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010515094616.B1835>