I was wondering what is the difference between uint32_t
and uint32
, and when I looked in the header files it had this:
types.h:
unsigned
and unsigned int
are synonymous for historical reasons; they both mean "unsigned integer of the most natural size for the CPU architecture/platform", which is often (but by no means always) 32 bits on modern platforms.
<stdint.h>
is a standard header in C99 that is supposed to give type definitions for integers of particular sizes, with the uint32_t
naming convention.
The <types.h>
that you're looking at appears to be non-standard and presumably belongs to some framework your project is using. Its uint32
typedef is compatible with uint32_t
. Whether you should use one or the other in your code is a question for your manager.
unsigned
and unsigned int
are synonymous, much like unsigned short [int]
and unsigned long [int]
.
uint32_t
is a type that's (optionally) defined by the C standard. uint32
is just a name you made up, although it happens to be defined as the same thing.
There is absolutely no difference between unsigned
and unsigned int
.
Whether that type is a good match for uint32_t
is implementation-dependant though; an int
could be "shorter" than 32 bits.
There is no difference.
unsigned int = uint32 = uint32_t = unsigned
in your case and unsigned int = unsigned
always