468,513 Members | 1,506 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

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 5187
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.

Similar topics

5 posts views Thread by drj0nson | last post: by
5 posts views Thread by Mark Shelor | last post: by
13 posts views Thread by Ioannis Vranos | last post: by
26 posts views Thread by kerravon | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.