X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fminmax.h;h=0e505109e745d24277d7a50a34efa63c5a1afa3a;hb=702381ebae6a90b07670cb45ab25a1a332eea511;hp=954af57367b6f47a1df50d28fa67c6af72c90c25;hpb=fdaa9692bae9ae2a12d719c8597ece44cf2c25dc;p=gnulib.git diff --git a/lib/minmax.h b/lib/minmax.h index 954af5736..0e505109e 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -18,11 +18,16 @@ #ifndef _MINMAX_H #define _MINMAX_H +/* Note: MIN, MAX are also defined in on some systems + (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about + MIN, MAX macro redefinitions on some systems; the workaround is to + #include this file as the last one among the #include list. */ + /* Before we define the following symbols we get the file since otherwise we get redefinitions on some systems. */ #include -/* Note: MIN and MAX should preferrably be used with two arguments of the +/* Note: MIN and MAX should be used with two arguments of the same type. They might not return the minimum and maximum of their two arguments, if the arguments have different types or have unusual floating-point values. For example, on a typical host with 32-bit 'int', @@ -37,28 +42,12 @@ /* MAX(a,b) returns the maximum of A and B. */ #ifndef MAX -# if __STDC__ && defined __GNUC__ && __GNUC__ >= 2 -# define MAX(a,b) (__extension__ \ - ({__typeof__ (a) _a = (a); \ - __typeof__ (b) _b = (b); \ - _a > _b ? _a : _b; \ - })) -# else -# define MAX(a,b) ((a) > (b) ? (a) : (b)) -# endif +# define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif /* MIN(a,b) returns the minimum of A and B. */ #ifndef MIN -# if __STDC__ && defined __GNUC__ && __GNUC__ >= 2 -# define MIN(a,b) (__extension__ \ - ({__typeof__ (a) _a = (a); \ - __typeof__ (b) _b = (b); \ - _a < _b ? _a : _b; \ - })) -# else -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -# endif +# define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #endif /* _MINMAX_H */