当前位置: C语言 -- 标准库 -- <stdint.h> -- INTPTR_WIDTH

INTPTR_WIDTH宏


概要:
#include <stdint.h>
#define INTPTR_WIDTH UINTPTR_WIDTH

描述:

该宏表示能够保存对象指针的有符号整数类型的宽度,即intptr_t类型的宽度。

如果实现提供了intptr_t类型,实现应定义宏INTPTR_WIDTH。该宏应替换为适合在#if预处理指令中使用的常量表达式,其实现定义值等于UINTPTR_WIDTH。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
/*宏INTPTR_WIDTH范例*/

#include <stdint.h>
#include <stdio.h>

int main(void)
{
    printf("INTPTR_WIDTH = %d\n", INTPTR_WIDTH);

    return 0;
}


可能输出:

INTPTR_WIDTH = 32

(注:编译时实现未定义宏INTPTR_WIDTH。)


相关内容:
UINTPTR_WIDTH 表示能够保存对象指针的无符号整数类型宽度的宏。


主要参考资料:

1、ISO/IEC 9899:2024