[PATCH] Fix type inconsistencies in stdint.h
Sat Apr 4 01:23:00 GMT 2009
Upstream GCC just gained the ability to know all about the stdint.h types
and limits internally. If you're interested in the background, see
and thread for further reading.
I've submitted the necessary info for the cygwin GCC backend, and now the
associated testcases show up a few bugs in our stdint.h declarations.
- uint32_t is "unsigned int", but UINT32_MAX is an unsigned long int constant
(denoted by the 'UL' suffix).
- int_least32_t is "long", where INT_LEAST32_MIN and INT_LEAST32_MAX are plain
(unsuffixed) int constants.
- int_fast16_t and int_fast32_t are both "long", where INT_FAST16/32_MIN/MAX
are all plain (unsuffixed) ints.
- intptr_t is "long" but INTPTR_MIN and INTPTR_MAX lack the "L" suffix and so
are just ints.
- size_t is "unsigned int" but the SIZE_MAX constant is unsigned long.
This is bad because if the value of one of these MIN or MAX limits is not of
the correct integer type matching the integer type it is used in conjunction
with, there will be an implicit cast operation anytime you assign the
wrongly-typed value to a variable of the type for which it is supposed to be
The attached patch fixes all these by adjusting only the suffix letters. OK
* include/stdint.h (UINT32_MAX, INT_LEAST32_MIN, INT_LEAST32_MAX,
INT_FAST16_MIN, INT_FAST32_MIN, INT_FAST16_MAX, INT_FAST32_MAX,
INTPTR_MIN, INTPTR_MAX, SIZE_MAX): Fix integer constant suffixes.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2222 bytes
Desc: not available
More information about the Cygwin-patches