471,850 Members | 1,113 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,850 software developers and data experts.

ULONG_LONG_MAX and gcc 3.4.1

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.
Aug 5 '06 #1
2 5373
Schraalhans Keukenmeester wrote:
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.hif GCC is
invoked in compliant mode.

S.
Aug 5 '06 #2
On Sat, 05 Aug 2006 18:48:00 +0200, in comp.lang.c , Schraalhans
Keukenmeester <fi********************@xsfourall.ennelwrote:
>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
Aug 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.