We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fad1b8 commit 77f7730Copy full SHA for 77f7730
docs/undef.md
@@ -314,7 +314,18 @@ i << 0; // 可以
314
i << -1; // 错!
315
```
316
317
-不过一个例外是[整数提升](https://zh.cppreference.com/w/cpp/language/implicit_conversion#.E6.95.B4.E6.95.B0.E6.8F.90.E5.8D.87)
+但是你还需要考虑一件事情:**隐式转换**,或者直接点说:**整数提升**。
318
+
319
+- 在 C++ 中算术运算符不接受小于 int 的类型进行运算。如果你觉得可以,那只是隐式转换,整形提升了。
320
321
+```cpp
322
+std::uint8_t c{ '0' };
323
+using T1 = decltype(c << 1); // int
324
+```
325
326
+即使移位大于等于 8 也不成问题。
327
328
+---
329
330
对于有符号整数,左移还不得破坏符号位
331
0 commit comments