Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

考虑介绍 C++26 起的错误行为 #76

Open
frederick-vs-ja opened this issue Dec 31, 2024 · 0 comments
Open

考虑介绍 C++26 起的错误行为 #76

frederick-vs-ja opened this issue Dec 31, 2024 · 0 comments

Comments

@frederick-vs-ja
Copy link
Contributor

cppguidebook/docs/undef.md

Lines 585 to 599 in 8119e85

### 不能读取未初始化的变量
```cpp
int i;
cout << i; // 错!
int i = 0;
cout << i; // 可以,会读到 0
int arr[10];
cout << arr[0]; // 错!
int arr[10] = {};
cout << arr[0]; // 可以,会读到 0
```

这里的错误操作在 C++26 起不再导致未定义行为而是导致(良定义的)错误行为,见 P2795R5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant