首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> C++ >> 關於C++

POCO 庫基本數據類型定義:跨平台整數類型詳解

     編輯:關於C++

Poco/Types.h:固定寬度整數類型

POCO 在 Poco/Types.h 中定義了一套跨平台的固定寬度整數類型,確保在不同編譯器和架構下的行為一致。以下以 GNU C/C++ 和 Clang 為例,POCO 支持幾乎所有主流平台。

1. 有符號整型

typedef signed char   Int8;
typedef signed short  Int16;
typedef signed int    Int32;

2. 無符號整型

typedef unsigned char  UInt8;
typedef unsigned short UInt16;
typedef unsigned int   UInt32;

3. 指針相關類型

typedef signed long   IntPtr;
typedef unsigned long UIntPtr;

4. 64 位整型(區分 32/64 位平台)

#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

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved