This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Determining whether long long is defined on a platform


Matt Minnis wrote:
> 
> Is there a automated way to determine if long long is defined or even valid
> on a given platform?

I do it this way:

  #include <limits.h>
  #if defined(LLONG_MAX) || defined(LONG_LONG_MAX)
    // assume we have long long
  #else
    // assume we don't have long long
  #endif

Probably not 100% reliable, but it's worked OK for me.

LLONG_MAX is the correct spelling according to C99, but GCC still uses
LONG_LONG_MAX (or did when I wrote the code; I haven't checked lately).

-- 
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"C++ is to programming as sex is to reproduction. Better ways might
technically exist but they're not nearly as much fun." -- Nikolai Irgens

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]