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

INT_LEASTN_WIDTH宏


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

描述:

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

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


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

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

int main(void)
{
    printf("INT_LEAST8_WIDTH = %d\n", INT_LEAST8_WIDTH);
    printf("INT_LEAST16_WIDTH = %d\n", INT_LEAST16_WIDTH);
    printf("INT_LEAST32_WIDTH = %d\n", INT_LEAST32_WIDTH);
    printf("INT_LEAST64_WIDTH = %d\n", INT_LEAST64_WIDTH);

    return 0;
}


可能输出:

INT_LEAST8_WIDTH = 8

INT_LEAST16_WIDTH = 16

INT_LEAST32_WIDTH = 32

INT_LEAST64_WIDTH = 64

(注:编译时实现未定义宏INT_LEAST8_WIDTH、INT_LEAST16_WIDTH、INT_LEAST32_WIDTH、INT_LEAST64_WIDTH。)


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


主要参考资料:

1、ISO/IEC 9899:2024