ULONG_LONG_MAX and gcc 3.4.1

  • Thread starter Schraalhans Keukenmeester
  • Start date
S

Schraalhans Keukenmeester

The header file limits.h contains the following:

#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LLONG_MIN
# define LLONG_MIN (-LLONG_MAX - 1LL)
# undef LLONG_MAX
# define LLONG_MAX __LONG_LONG_MAX__

/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULLONG_MAX
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif

#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined
(__STRICT_ANSI__)
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LONG_LONG_MIN
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
# undef LONG_LONG_MAX
# define LONG_LONG_MAX __LONG_LONG_MAX__

/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULONG_LONG_MAX
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
#endif

When I include this in my programs the LONG LONG type definitions aren't
available, so I gather either or both of the #ifdef conditions
(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L

are not met. I am on a Gentoo Linux box, 2.6.17 kernel, using gcc 3.41
I haven't been able to find out how to get these conditions evaluate to
be true. Is it a gcc setting, inclusion of another header file, or
something else ?

Thanks
Sh.
 
S

Skarmander

Schraalhans said:
The header file limits.h contains the following:

#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LLONG_MIN
# define LLONG_MIN (-LLONG_MAX - 1LL)
# undef LLONG_MAX
# define LLONG_MAX __LONG_LONG_MAX__

/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULLONG_MAX
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif
Note: ULLONG_MAX.
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined
(__STRICT_ANSI__)
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LONG_LONG_MIN
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
# undef LONG_LONG_MAX
# define LONG_LONG_MAX __LONG_LONG_MAX__

/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULONG_LONG_MAX
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
#endif
Note: ULONG_LONG_MAX.
When I include this in my programs the LONG LONG type definitions aren't
available, so I gather either or both of the #ifdef conditions
(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L

are not met. I am on a Gentoo Linux box, 2.6.17 kernel, using gcc 3.41
I haven't been able to find out how to get these conditions evaluate to
be true. Is it a gcc setting, inclusion of another header file, or
something else ?
Try gnu.gcc for all your GCC questions.

The short answer is to use ULLONG_MAX, which is covered by the standard.
ULONG_LONG_MAX is nonstandard and will not appear in <limits.h> if GCC is
invoked in compliant mode.

S.
 
M

Mark McIntyre

The header file limits.h contains the following:
(snip some conditional code)

When I include this in my programs the LONG LONG type definitions aren't
available, so I gather either or both of the #ifdef conditions
(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L

are not met. I am on a Gentoo Linux box, 2.6.17 kernel, using gcc 3.41
I haven't been able to find out how to get these conditions evaluate to
be true. Is it a gcc setting, inclusion of another header file, or
something else ?

This is a GCC question, and you should ask in a gcc group or RTFM.
Consider also the effect of commandline options to gcc.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top