On Mon, 14 May 2001, Dima Dorfman wrote:

> 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

It is to inhibit use of these macros.  The {i,,l,lu,q}{max,min} inline
functions are supposed to be used instead.

Both of these interfaces are problematic.  MIN/MAX can not be implemented
to be "safe" macros in Standard C since they need to evaluate their
args more than once.  Their upper case names indicate that they are
unsafe.  The {i,,l,lu,q}{max,min} functions are not type-generic, so
they are difficult to use correctly for args whose type is typedef'ed.

> 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?

This is a bug in these files.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to