What do __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS mean?(__STDC_LIMIT_MACROS 和 __STDC_CONSTANT_MACROS 是什么意思?)
问题描述
我在系统的标准 C++ 库以及我正在使用的库中的一些头文件中看到了这一点.
I see this in the standard C++ libraries for my system, as well as some of the headers in a library I'm using.
这两个定义的语义是什么?除了源代码本身之外,是否有这样的#defines 的良好参考?
What are the semantics of these two definitions? Is there a good reference for #defines like this other than the source itself?
推荐答案
__STDC_LIMIT_MACROS 和 __STDC_CONSTANT_MACROS 是一种允许 C++ 程序使用 stdint.h C99 标准中指定但不在 C++ 标准中的宏.UINT8_MAX、INT64_MIN 和 INT32_C() 等宏可能已经以其他方式在 C++ 应用程序中定义.为了让用户决定他们是否想要像 C99 那样定义的宏,许多实现要求在 stdint.h 之前定义 __STDC_LIMIT_MACROS 和 __STDC_CONSTANT_MACROS包括在内.
__STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are a workaround to allow C++ programs to use stdint.h macros specified in the C99 standard that aren't in the C++ standard. The macros, such as UINT8_MAX, INT64_MIN, and INT32_C() may be defined already in C++ applications in other ways. To allow the user to decide if they want the macros defined as C99 does, many implementations require that __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS be defined before stdint.h is included.
这不是 C++ 标准的一部分,但已被多个实现采用.
This isn't part of the C++ standard, but it has been adopted by more than one implementation.
这篇关于__STDC_LIMIT_MACROS 和 __STDC_CONSTANT_MACROS 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:__STDC_LIMIT_MACROS 和 __STDC_CONSTANT_MACROS 是什么意思?
基础教程推荐
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
