<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)則?NL.11:使字面值可讀

          NL.11: Make literals readable

          NL.11:使字面值可讀


          Reason(原因)

          Readability.

          可讀性。


          Example(示例)

          Use digit separators to avoid long strings of digits

          使用數(shù)字分隔符避免數(shù)字過長(zhǎng)

          auto c = 299'792'458; // m/s2
          auto q2 = 0b0000'1111'0000'0000;
          auto ss_number = 123'456'7890;
          Example(示例)

          Use literal suffixes where clarification is needed

          在需要說明時(shí)使用字面值后綴

          auto hello = "Hello!"s; // a std::string
          auto world = "world"; // a C-style string
          auto interval = 100ms; // using
          Note(注意)

          Literals should not be sprinkled all over the code as?"magic constants", but it is still a good idea to make them readable where they are defined. It is easy to make a typo in a long string of integers.

          不應(yīng)將字面值以“魔術(shù)常數(shù)”的形式散布在整個(gè)代碼中,即使這樣做了,使它們?cè)诙x的地方可讀仍是一個(gè)好主意。用一長(zhǎng)串整數(shù)輸入錯(cuò)字很容易。

          Enforcement(實(shí)施建議)

          Flag long digit sequences. The trouble is to define "long"; maybe 7.

          標(biāo)記長(zhǎng)數(shù)字序列。麻煩在于如何定義“長(zhǎng)”;也許長(zhǎng)于7可以作為一個(gè)標(biāo)準(zhǔn)。


          原文鏈接

          https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nl11-make-literals-readable


          新書介紹

          《實(shí)戰(zhàn)Python設(shè)計(jì)模式》是作者最近出版的新書,拜托多多關(guān)注!

          本書利用Python 的標(biāo)準(zhǔn)GUI 工具包tkinter,通過可執(zhí)行的示例對(duì)23 個(gè)設(shè)計(jì)模式逐個(gè)進(jìn)行說明。這樣一方面可以使讀者了解真實(shí)的軟件開發(fā)工作中每個(gè)設(shè)計(jì)模式的運(yùn)用場(chǎng)景和想要解決的問題;另一方面通過對(duì)這些問題的解決過程進(jìn)行說明,讓讀者明白在編寫代碼時(shí)如何判斷使用設(shè)計(jì)模式的利弊,并合理運(yùn)用設(shè)計(jì)模式。

          對(duì)設(shè)計(jì)模式感興趣而且希望隨學(xué)隨用的讀者通過本書可以快速跨越從理解到運(yùn)用的門檻;希望學(xué)習(xí)Python GUI 編程的讀者可以將本書中的示例作為設(shè)計(jì)和開發(fā)的參考;使用Python 語言進(jìn)行圖像分析、數(shù)據(jù)處理工作的讀者可以直接以本書中的示例為基礎(chǔ),迅速構(gòu)建自己的系統(tǒng)架構(gòu)。




          覺得本文有幫助?請(qǐng)分享給更多人。

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

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



          瀏覽 59
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          <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>
                  国产高清无码福利 | 在线中文字幕亚洲三级片 | 18禁成人h网站 | 日韩成人在线电影 | 超碰免费在线97 |