鉴于这个C 11计划,我应该期待看到一个数字还是一个字母?还是没有期望?
#include
#include
int main()
{
int8_t i = 65;
std::cout << i;
}
标准是否指定此类型是否可以是字符类型?
解决方法:
根据C 0x FDIS(N3290)的§18.4.1[cstdint.syn],int8_t是一个可选的typedef,其指定如下:
namespace std {
typedef signed integer type int8_t; // optional
//...
} // namespace std
§3.9.1[basic.fundamental]陈述:
There are five standard signed integer types: “signed char”, “short int”, “int”, “long int”, and “long long int”. In this list, each type provides at least as much storage as those preceding it in the list. There may also be implementation-defined extended signed integer types. The standard and extended signed integer types are collectively called signed integer types.
…
Types bool, char, char16_t, char32_t, wchar_t, and the