PATCH: Use __LONG_LONG_MAX__ if LONG_LONG_MIN etc are not available

Gabriel Dos Reis gdr@codesourcery.com
Tue Jul 31 09:53:00 GMT 2001


Loren James Rittle <rittle@latour.rsch.comm.mot.com> writes:

| Instead of all the shenanigans to get this right in light of various
| glibc versions and command line switches that influence limits.h, how
| about we convert uses of LONG_LONG_MIN, LONG_LONG_MAX and
| ULONG_LONG_MAX to use __LONG_LONG_MAX__ (which is unconditionally
| defined by the gcc-generated limits.h file) when the former macros are
| not available.  I will arbitrarily key off LONG_LONG_MIN.

An excellent suggestion!

| + #ifdef LONG_LONG_MIN 
|   DEFINE_EXTREMA(long long, LONG_LONG_MIN, LONG_LONG_MAX);
|   DEFINE_EXTREMA(unsigned long long, 0, ULONG_LONG_MAX);
| + #else
| + DEFINE_EXTREMA(long long, (-__LONG_LONG_MAX__-1), __LONG_LONG_MAX__);
| + DEFINE_EXTREMA(unsigned long long, 0, (__LONG_LONG_MAX__ * 2ULL + 1));
| + #endif

Is the #ifdef bits necessary?  Why not just use __LONG_LONG_MAX__
unconditionally?

Apart from that, the pacth looks pretty good and can go on branch and
mainline. 

Thanks,

-- Gaby



More information about the Libstdc++ mailing list