第一章 新基础类型

整数类型longlong

1
2
3
4
5
6
7
8
//自变量后缀可以是大写也可以是小写
long long x = 65536ll;
unsigned long long y = 65536ull;
//判断最大最小值
// std::numeric_limits<long long>
std::cout<<"std::numeric_limits<long long>::max()="<<std::numeric_limits<long long>::max()<<std::endl;
std::cout<<"std::numeric_limits<long long>::min()="<<std::numeric_limits<long long>::min()<<std::endl;
std::cout<<"std::numeric_limits<long long>::max()="<<std::numeric_limits<long long>::max()<<std::endl;

char16_t 和 char32_t

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//前缀
char16_t utf16c = u'好';
char32_t utf32c = U'好';

char16_t utf16[] = u"你好世界!";
char32_t utf32[] = U"你好世界!";
//wchar_t
//Windows /编程常用的字符类型
typedef const wchar_t* LPCWSTR;
BOOL PathFileExistsW(LPCWSTR pszPath);
//char8_t
char str[] = u8"test"; //C++17编译成功;C++20编译失败,需要char8_t
char c = u8'C';
char8_t c8a[] = "test"; //C++20编译失败,需要char
char8_t c8 = 'C';

第2章 内联和嵌套命名空间