Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 便携式检查是否存在非便携式集成类型的方法_C++ - Fatal编程技术网

C++ 便携式检查是否存在非便携式集成类型的方法

C++ 便携式检查是否存在非便携式集成类型的方法,c++,C++,我想通过int64_t来获取我的int,当出现在c++98或更高版本的实现中时,我知道c++11已经提供了64位int。 是否有一种可移植的通用方法来检查int64_t的存在,或者更好地检查可用的任何64位或更大的整数类型,如: #ifdef has_int64_t typedef int64_t myint #else typedef int myint #endif //...code myint a; 如果可能,该检查适用于c++98、c++03和c++11。非常确定使用stdint.

我想通过int64_t来获取我的int,当出现在c++98或更高版本的实现中时,我知道c++11已经提供了64位int。 是否有一种可移植的通用方法来检查int64_t的存在,或者更好地检查可用的任何64位或更大的整数类型,如:

#ifdef has_int64_t
typedef int64_t myint
#else
typedef int myint
#endif

//...code
myint a;

如果可能,该检查适用于c++98、c++03和c++11。

非常确定使用stdint.h时该检查适用:

#ifdef INT64_C
//...
#else
//...
#endif

使用stdint.h和C++11cstdint头的情况相当棘手。特别是因为在某些VS版本中缺少它们。最简单的路线当然是。

请接受更多答案。