POCO 在 Poco/Types.h 中定義了一套跨平台的固定寬度整數類型,確保在不同編譯器和架構下的行為一致。以下以 GNU C/C++ 和 Clang 為例,POCO 支持幾乎所有主流平台。
typedef signed char Int8;
typedef signed short Int16;
typedef signed int Int32;
typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef unsigned int UInt32;
typedef signed long IntPtr;
typedef unsigned long UIntPtr;
#if defined(__LP64__)
#define POCO_PTR_IS_64_BIT 1
#define POCO_LONG_IS_64_BIT 1
typedef signed long Int64;
typedef unsigned long UInt64;
#else
typedef signed long long Int64;
typedef unsigned long long UInt64;
#endif
#define POCO_HAVE_INT64 1
在 LP64 模型(Linux/macOS 64 位)下 long 為 64 位;在 LLP64 模型(Windows 64 位)下 long long 為 64 位。POCO 通過預處理器自動選擇正確定義。
來自柳大的 CSDN 博客:Blog.CSDN.net/Poechant