我正在阅读 this page上面写着
If one of the strings has an encoding prefix and the other doesn't, the one that doesn't will be considered to have the same encoding prefix as the other.
L"Δx = %" PRId16 // at phase 4, PRId16 expands to "d"
// at phase 6, L"Δx = %" and "d" form L"Δx = %d"
If a UTF-8 string literal and a wide string literal are side by side, the program is ill-formed.
为什么 PRId16
扩展为 d
?这是在哪里定义的?
最佳答案
在 C99(及以后)语言标准中,作为 <inttypes.h>
的一部分:
[7.8.1] Each of the following object-like macros expands to a character string literal containing a conversion specifier, possibly modified by a length modifier, suitable for use within the format argument of a formatted input/output function when converting the corresponding integer type. These macro names have the general form of
PRI
[...]
参见 here供在线引用。
C++标准继承了C的标准库,所以以上可以在<cinttypes>
中找到.
关于c++ - PRId16 扩展到 d,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44279873/