什么是Visual C ++中int32_t的等价物?

时间:2022-09-01 09:36:50

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

什么是Visual C ++中int32_t的等价物?

4 个解决方案

#1


37  

Visual C++ 2010 include <cstdint>, which includes typedef std::int32_t (you can also include <stdint.h> which has the same typedef in the global namespace).

Visual C ++ 2010包括 ,其中包括typedef std :: int32_t(您还可以包含 ,它在全局命名空间中具有相同的typedef)。

If you are using an older version of Visual C++, you can use Boost's <cstdint> implementation.

如果您使用的是旧版本的Visual C ++,则可以使用Boost的 实现。

#2


8  

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

在确保类型存在之后,我所做的是创建自己的typedef:

#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;

#3


7  

If you have a pre-cstdint version of Visual Studio, you can use __int32.

如果您具有Visual Studio的pre-cstdint版本,则可以使用__int32。

#4


1  

int. But, if you want to continue using the stdint typedefs in VC++ versions prior to 2010 (in which the cstdint header was introduced), consider using Boost.Config's cstdint implementation.

INT。但是,如果你想继续在2010年之前(在其中引入了cstdint头)VC ++版本使用stdint的typedef,可以考虑使用Boost.Config的cstdint实现。

#1


37  

Visual C++ 2010 include <cstdint>, which includes typedef std::int32_t (you can also include <stdint.h> which has the same typedef in the global namespace).

Visual C ++ 2010包括 ,其中包括typedef std :: int32_t(您还可以包含 ,它在全局命名空间中具有相同的typedef)。

If you are using an older version of Visual C++, you can use Boost's <cstdint> implementation.

如果您使用的是旧版本的Visual C ++,则可以使用Boost的 实现。

#2


8  

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

在确保类型存在之后,我所做的是创建自己的typedef:

#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;

#3


7  

If you have a pre-cstdint version of Visual Studio, you can use __int32.

如果您具有Visual Studio的pre-cstdint版本,则可以使用__int32。

#4


1  

int. But, if you want to continue using the stdint typedefs in VC++ versions prior to 2010 (in which the cstdint header was introduced), consider using Boost.Config's cstdint implementation.

INT。但是,如果你想继续在2010年之前(在其中引入了cstdint头)VC ++版本使用stdint的typedef,可以考虑使用Boost.Config的cstdint实现。