J
justinx
Hi all,
I have a question that I have been unable to answer. It is bugging me. It is specifically related to the C99 integer types.
My question has been posted on stackoverflow. But I have received only one answer that was of no help.
http://stackoverflow.com/questions/11381764/arm-cortex-m3-uint-fast32-t-vs-uint32-t
http://stackoverflow.com/questions/11518212/c99s-fixed-width-integer-types
To be very specific. I am working with an STM32F103RCT6 Cortex-M3. The C compiler I am using is Code Sourcery G++ Lite 2011.03-42 (4.5.2).
In <stdint.h> the follow types are defined:
typedef unsigned int uint_fast32_t;
typedef uint32_t uint_least32_t;
typedef unsigned long uint32_t;
-. On this platform sizeof(int) == sizeof(long). Why are the new types not all unsigned ints or all unsigned longs?
-. What I find even more interesting is the underlying type of uint32_least_t (unsigned long) is larger (or at least equal) than uint32_fast_t (unsigned int). This does not seem logical to me. Surely the least width integer type would use the smallest basic type possible.
Any insight in to the selection process for establishing the underlying data types for the fixed, minimum and fastest width types would be great.
This leads to one other questions. If sizeof(int) == sizeof(long), is there ANY difference (performance or otherwise) in using one over the other?
Thanks
Justin
I have a question that I have been unable to answer. It is bugging me. It is specifically related to the C99 integer types.
My question has been posted on stackoverflow. But I have received only one answer that was of no help.
http://stackoverflow.com/questions/11381764/arm-cortex-m3-uint-fast32-t-vs-uint32-t
http://stackoverflow.com/questions/11518212/c99s-fixed-width-integer-types
To be very specific. I am working with an STM32F103RCT6 Cortex-M3. The C compiler I am using is Code Sourcery G++ Lite 2011.03-42 (4.5.2).
In <stdint.h> the follow types are defined:
typedef unsigned int uint_fast32_t;
typedef uint32_t uint_least32_t;
typedef unsigned long uint32_t;
-. On this platform sizeof(int) == sizeof(long). Why are the new types not all unsigned ints or all unsigned longs?
-. What I find even more interesting is the underlying type of uint32_least_t (unsigned long) is larger (or at least equal) than uint32_fast_t (unsigned int). This does not seem logical to me. Surely the least width integer type would use the smallest basic type possible.
Any insight in to the selection process for establishing the underlying data types for the fixed, minimum and fastest width types would be great.
This leads to one other questions. If sizeof(int) == sizeof(long), is there ANY difference (performance or otherwise) in using one over the other?
Thanks
Justin