This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[PATCH] stdint.h define of INT32_MIN
- From: "Gerrit P. Haase" <gp at familiehaase dot de>
- To: cygwin-patches at cygwin dot com
- Date: Fri, 8 Aug 2003 13:37:51 +0200
- Subject: [PATCH] stdint.h define of INT32_MIN
- Organization: Esse keine toten Tiere
Hallo ,
The Open Group Base Specifications Issue 6 says here:
http://www.opengroup.org/onlinepubs/007904975/basedefs/stdint.h.html
"An N-bit signed type has values in the range -2**(N-1) or 1-2**(N-1)
to 2**(N-1)-1, while an N-bit unsigned type has values in the range 0
to 2**(N-1)."
Which is in this case:
-2**31 = -2147483648
OR
1-2**31 = -2147483647
Using #define INT32_MIN (-21474836478) breaks the perl build on
Cygwin because this constant is used in some typecasts, and it also
gives my this warning everytime INT32_MIN is used:
xyz.c:2: warning: this decimal constant is unsigned only in ISO C90
Both of the below patches are ok. for me to build perl and also there
are no warnings issued, the first is the way it is defined on Linux
too, the second seems to be alright according to the SUS specs:
$ diff -udp stdint.h~ stdint.h
--- stdint.h~ 2003-08-08 13:14:19.248036800 +0200
+++ stdint.h 2003-08-08 13:14:36.452776000 +0200
@@ -70,7 +70,7 @@ typedef unsigned long long uintmax_t;
#define INT8_MIN (-128)
#define INT16_MIN (-32768)
-#define INT32_MIN (-2147483648)
+#define INT32_MIN (-2147483647-1)
#define INT64_MIN (-9223372036854775808)
#define INT8_MAX (127)
# END
$ diff -udp stdint.h~ stdint.h
--- stdint.h~ 2003-08-08 13:14:19.248036800 +0200
+++ stdint.h 2003-08-08 13:15:12.775004800 +0200
@@ -70,7 +70,7 @@ typedef unsigned long long uintmax_t;
#define INT8_MIN (-128)
#define INT16_MIN (-32768)
-#define INT32_MIN (-2147483648)
+#define INT32_MIN (-2147483647)
#define INT64_MIN (-9223372036854775808)
#define INT8_MAX (127)
# END
Gerrit
--
=^..^=