In article <[EMAIL PROTECTED]>,
Bruce Evans  <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to