Alex Rivera | Logout

What's the equivalent of int32_t in Visual C++?

Asked 2011-04-14T02:11:33.600
19

What's the equivalent of int32_t in Visual C++?

Edit
Report

1 Answer

8

What I do is make my own typedefs after making sure the types exist like so:

#ifdef _MSC_VER
    #if _MSC_VER >= 1600
        #include <cstdint>
    #else
        typedef __int8              int8_t;
        typedef __int16             int16_t;
        typedef __int32             int32_t;
        typedef __int64             int64_t;
        typedef unsigned __int8     uint8_t;
        typedef unsigned __int16    uint16_t;
        typedef unsigned __int32    uint32_t;
        typedef unsigned __int64    uint64_t;
    #endif
#elif __GNUC__ >= 3
    #include <cstdint>
#endif

typedef int8_t      s8;
typedef int16_t     s16;
typedef int32_t     s32;
typedef int64_t     s64;
typedef uint8_t     u8;
typedef uint16_t    u16;
typedef uint32_t    u32;
typedef uint64_t    u64;
answered 2013-01-30T23:08:54.843

Your Answer