Skip to content

Commit a53483e

Browse files
committed
deploy: 0aca22a
1 parent 89cec24 commit a53483e

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ <h2 id="_1">前言</h2>
292292
<blockquote>
293293
<p><img src="./img/bulb.png" height="30px" width="auto" style="margin: 0; border: none"/> 本书还在持续更新中……要追番的话,可以在 <a href="https://github.com/parallel101/cppguidebook">GitHub</a> 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</p>
294294
</blockquote>
295-
<p>更新时间:2024年11月26日 12:33:25 (UTC+08:00)</p>
295+
<p>更新时间:2024年12月17日 11:34:36 (UTC+08:00)</p>
296296
<p><a href="https://parallel101.github.io/cppguidebook">在 GitHub Pages 浏览本书</a> | <a href="https://142857.red/book">在小彭老师自己维护的镜像上浏览本书</a></p>
297297
<h2 id="_2">格式约定</h2>
298298
<blockquote>

print_page/index.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ <h2 id="index-_1">前言</h2>
421421
<blockquote>
422422
<p><img src="../img/bulb.png" height="30px" width="auto" style="margin: 0; border: none"/> 本书还在持续更新中……要追番的话,可以在 <a href="https://github.com/parallel101/cppguidebook">GitHub</a> 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</p>
423423
</blockquote>
424-
<p>更新时间:2024年11月26日 12:33:25 (UTC+08:00)</p>
424+
<p>更新时间:2024年12月17日 11:34:36 (UTC+08:00)</p>
425425
<p><a href="https://parallel101.github.io/cppguidebook">在 GitHub Pages 浏览本书</a> | <a href="https://142857.red/book">在小彭老师自己维护的镜像上浏览本书</a></p>
426426
<h2 id="index-_2">格式约定</h2>
427427
<blockquote>
@@ -19203,6 +19203,15 @@ <h3 id="undef-_9">左移或右移的位数,不得超过整数类型上限,
1920319203
i &lt;&lt; 0; // 可以
1920419204
i &lt;&lt; -1; // 错!
1920519205
</code></pre>
19206+
<p>但是你还需要考虑一件事情:<strong>隐式转换</strong>,或者直接点说:<strong>整数提升</strong>。</p>
19207+
<ul>
19208+
<li>在 C++ 中算术运算符不接受小于 int 的类型进行运算。如果你觉得可以,那只是隐式转换,整形提升了。</li>
19209+
</ul>
19210+
<pre><code class="language-cpp">std::uint8_t c{ '0' };
19211+
using T1 = decltype(c &lt;&lt; 1); // int
19212+
</code></pre>
19213+
<p>即使移位大于等于 8 也不成问题。</p>
19214+
<hr />
1920619215
<p>对于有符号整数,左移还不得破坏符号位</p>
1920719216
<pre><code class="language-cpp">int i = 0;
1920819217
i &lt;&lt; 1; // 可以

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

sitemap.xml.gz

0 Bytes
Binary file not shown.

undef/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,15 @@ <h3 id="_9">左移或右移的位数,不得超过整数类型上限,不得
583583
i &lt;&lt; 0; // 可以
584584
i &lt;&lt; -1; // 错!
585585
</code></pre>
586+
<p>但是你还需要考虑一件事情:<strong>隐式转换</strong>,或者直接点说:<strong>整数提升</strong></p>
587+
<ul>
588+
<li>在 C++ 中算术运算符不接受小于 int 的类型进行运算。如果你觉得可以,那只是隐式转换,整形提升了。</li>
589+
</ul>
590+
<pre><code class="language-cpp">std::uint8_t c{ '0' };
591+
using T1 = decltype(c &lt;&lt; 1); // int
592+
</code></pre>
593+
<p>即使移位大于等于 8 也不成问题。</p>
594+
<hr />
586595
<p>对于有符号整数,左移还不得破坏符号位</p>
587596
<pre><code class="language-cpp">int i = 0;
588597
i &lt;&lt; 1; // 可以

0 commit comments

Comments
 (0)