Please have a look at CR 4149430.

Notably, min and max are defined as *macros* in ddi.h:

#define min(a, b)       ((a) < (b) ? (a) : (b))

However, the man page for these indicates that signed comparison should 
be used only, and is strongly suggestive of a function:

SYNOPSIS
     #include <sys/ddi.h>

     int min(int int1, int int2);

Adding a wrinkle, systm.h (which generally should not be included by 
drivers) declares a version consistent with the man pages.

The question is, which is *correct* -- the man page, or the ddi.h header 
file.  I admit that I find the macro version a bit more satisfying, 
since it allows comparison of unsigned values, as well as values that 
may be larger than an integer (64 bit types, pointer types) -- but I'm 
willing to hear counter arguments.

If the answer is that the macro version should stand, then probably we 
should update the man pages and remove the functional version (or at 
least the declaration of it) from systm.h.

    -- Garrett


_______________________________________________
driver-discuss mailing list
driver-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to