What is the difference between u_int32_t
and uint32_t
?
Asked
Active
Viewed 8,610 times
15
-
1The latter is defined in C99's header, `stdint.h`. The former is not. From http://lists.freedesktop.org/archives/release-wranglers/2004-August/000925.html it looks like maybe the u_ forms were used in BSD Unix? Anyway, you should use `uint32_t` in your code. – Conrad Meyer Feb 23 '11 at 12:13
-
@Conrad Why is this a comment and not an answer? – Core Xii Feb 23 '11 at 12:18
-
@Core Xii: *Shrug*. I had never heard of u_int32_t before responding, I'm not an authoritative source on this. – Conrad Meyer Feb 23 '11 at 12:23
4 Answers
15
uint32_t
is a standard C99 type u_int32_t
is used internally in some POSIX implementations.

Šimon Tóth
- 35,456
- 20
- 106
- 151
-
[What is POSIX?](https://stackoverflow.com/q/1780599/2023530) This link answers the question which occurred to me. – Hoseyn Heydari Jul 08 '18 at 16:26
4
As others have mentioned, uint32_t is a standard C99 type.
Anyway, the takeaway is that if you're writing portable C code or C header files meant to be shared between different devices/architectures, you can use stdint.h.

larryang
- 41
- 2
1
uint32_t is standard C99, while u_int32_t is used on certain Unix platforms.

Unsigned
- 9,640
- 4
- 43
- 72
0
The variable type uint32_t is an unsigned 32-bit integer data type defined according to the so-called C99 standard. Not all compilers comply with the standard. And u_int32_t is used for some internally implementations.

metastack
- 11
- 2