Question:
I see this in the standard C++ libraries for my system, as well as some of the headers in a library I'm using.
What are the semantics of these two definitions? Is there a good reference for #defines like this other than
the source itself?
Anwser:
__STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are a workaround to allow C++ programs to use 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.
This isn't part of the C++ standard, but it has been adopted by more than one implementation.
本文详细解释了C++中__STDC_LIMIT_MACROS和__STDC_CONSTANT_MACROS这两个宏的含义及用途,如何允许C++程序使用C99标准中未包含的宏,并提供了实例说明。
1279

被折叠的 条评论
为什么被折叠?



