[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stdint_.h vs intmax_t & uintmax_t
From: |
Paul Eggert |
Subject: |
Re: stdint_.h vs intmax_t & uintmax_t |
Date: |
Mon, 14 Nov 2005 22:58:23 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
"Mark D. Baushke" <address@hidden> writes:
> There is one remaining interaction with stdint_.h and config.h
> which arises from m4/size_max.m4
>
> % grep SIZE_MAX config.h
> config.h:#define SIZE_MAX 4294967295U
> % grep lib/stdint_.h
> #define SIZE_MAX (~(size_t)0)
Thanks for mentioning that. The obvious workaround is to ifdef
SIZE_MAX as well. Something like this.
I'd like Bruno's opinion on all this before installing into gnulib.
2005-11-14 Paul Eggert <address@hidden>
* lib/stdint_.h (intmax_t) [defined intmax_t]: Do not declare.
(uintmax_t) [defined uintmax_t]: Do not declare.
(SIZE_MAX) [defined SIZE_MAX]: Do not define.
This works around a problem if intmax_t.m4 and/or uintmax_t.m4
and/or size_max.m4 are also used. Problem reported by Mark D. Baushke.
--- stdint_.h.~1.7.~ 2005-05-23 03:22:39.000000000 -0700
+++ stdint_.h 2005-11-14 22:55:22.000000000 -0800
@@ -133,11 +133,19 @@ typedef unsigned long uintptr_t;
/* 7.18.1.5. Greatest-width integer types */
#ifdef _STDINT_H_HAVE_INT64
+# ifndef intmax_t
typedef int64_t intmax_t;
+# endif
+# ifndef uintmax_t
typedef uint64_t uintmax_t;
+# endif
#else
+# ifndef intmax_t
typedef int32_t intmax_t;
+# endif
+# ifndef uintmax_t
typedef uint32_t uintmax_t;
+# endif
#endif
/* 7.18.2. Limits of specified-width integer types */
@@ -230,7 +238,9 @@ typedef uint32_t uintmax_t;
#define SIG_ATOMIC_MIN 0
#define SIG_ATOMIC_MAX 127
-#define SIZE_MAX (~(size_t)0)
+#ifndef SIZE_MAX
+# define SIZE_MAX (~(size_t)0)
+#endif
/* wchar_t limits already defined in <stddef.h>. */
/* wint_t limits already defined in <wchar.h>. */