<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          C++核心準(zhǔn)則ES.75: 避免使用do語句

          34f9bc09653f5184bba452a4d038ae11.webp

          ES.75: Avoid?do-statements

          ES.75: 避免使用do語句


          Reason(原因)

          Readability, avoidance of errors. The termination condition is at the end (where it can be overlooked) and the condition is not checked the first time through.

          可讀性,避免錯誤。中止條件位于循環(huán)的最后(可能被忽視的位置),并且第一次進入循環(huán)時不會檢查循環(huán)條件


          Example(示例)

          int x;
          do {
          cin >> x;
          // ...
          } while (x < 0);
          Note(注意)

          Yes, there are genuine examples where a?do-statement is a clear statement of a solution, but also many bugs.

          確實存在使用do語句的清晰易懂的例子,但同時也存在很多錯誤。


          Enforcement(實施建議)

          Flag?do-statements.

          標(biāo)記使用do語句的代碼。


          原文鏈接

          https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es75-avoid-do-statements




          覺得本文有幫助?請分享給更多人。

          關(guān)注微信公眾號【面向?qū)ο笏伎肌枯p松學(xué)習(xí)每一天!

          面向?qū)ο箝_發(fā),面向?qū)ο笏伎迹?/span>

          瀏覽 68
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  大鸡巴操逼免费视频 | 中文三区 | 青娱乐中文 | 99热精品中文在线播放 | 久久爱成人电影 |