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

UINT_LEASTN_WIDTH宏


概要:
#include <stdint.h>
#define UINT_LEASTN_WIDTH N

描述:

该宏表示最小宽度为N的无符号整数类型的宽度,即uint_leastN_t类型的宽度。

该宏应替换为适合在#if预处理指令中使用的常量表达式,其实现定义值大于等于N。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
/*宏UINT_LEASTN_WIDTH范例*/

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

int main(void)
{
    printf("UINT_LEAST8_WIDTH = %d\n", UINT_LEAST8_WIDTH);
    printf("UINT_LEAST16_WIDTH = %d\n", UINT_LEAST16_WIDTH);
    printf("UINT_LEAST32_WIDTH = %d\n", UINT_LEAST32_WIDTH);
    printf("UINT_LEAST64_WIDTH = %d\n", UINT_LEAST64_WIDTH);

    return 0;
}


可能输出:

UINT_LEAST8_WIDTH = 8

UINT_LEAST16_WIDTH = 16

UINT_LEAST32_WIDTH = 32

UINT_LEAST64_WIDTH = 64

(注:编译时实现未定义宏UINT_LEAST8_WIDTH、UINT_LEAST16_WIDTH、UINT_LEAST32_WIDTH、UINT_LEAST64_WIDTH。)


相关内容:
INT_LEASTN_WIDTH 表示最小宽度为N的有符号整数类型宽度的宏。


主要参考资料:

1、ISO/IEC 9899:2024