约 992 字

约 5 分钟

#C 语言标准库宏 UINTMAX_C

下面以函数形式说明宏的调用接口。

#include <stdint.h>

integer_constant UINTMAX_C(value);

说明

为 uintmax_t 对应的整数类型构造常量表达式。

展开形式取决于实现。需要带负号的常量时,可在有符号宏的调用表达式外应用一元负号。

自 C99 起提供。

参数

  • value - 无后缀的非负整数常量,数值须能以对应类型表示。

返回值

  • 整数常量表达式,可用于预处理整数条件。结果类型为 uintmax_t 经整数提升后的类型。

#示例

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

int main(void)
{
    uintmax_t number = UINTMAX_C(42);
    printf("%ju\n", (uintmax_t)number);
    return 0;
}

运行结果。

42

#相关接口

#参考标准

更新: 2026/11/28

作者: planc

创建: 2026/11/28