Difference between uint32 and uint32_t

C++CUint32Uint32 T

C++ Problem Overview


> Possible Duplicate:
> Difference between different integer types

What is the difference between uint32 and uint32_t in C/C++?

Are they OS-dependent?

In which case should I use one or another?

C++ Solutions


Solution 1 - C++

uint32_t is standard, uint32 is not. That is, if you include <inttypes.h> or <stdint.h>, you will get a definition of uint32_t. uint32 is a typedef in some local code base, but you should not expect it to exist unless you define it yourself. And defining it yourself is a bad idea.

Solution 2 - C++

uint32_t is defined in the standard, in

18.4.1 Header <cstdint> synopsis [cstdint.syn]
namespace std {
//...
typedef unsigned integer type uint32_t; // optional
//...
}

uint32 is not, it's a shortcut provided by some compilers (probably as typedef uint32_t uint32) for ease of use.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMaxbesterView Question on Stackoverflow
Solution 1 - C++William PursellView Answer on Stackoverflow
Solution 2 - C++Luchian GrigoreView Answer on Stackoverflow