This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] stdint.h define of INT32_MIN


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
-- 
=^..^=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]