原创 C++核心準則ES.22:沒有合適的初始值就不要定義變量

ES.22: Don't declare a variable until you have a value to initialize it with DS.22:沒有合適的初始值就不要定義變量   Reason(原因) Readabi

原创 C++核心準則ES.24: 使用unique_ptr(T)管理指針

ES.24: Use a unique_ptr<T> to hold pointers ES.24: 使用unique_ptr<T>管理指針   Reason(原因) Using std::unique_ptr is the simple

原创 C++核心準則ES.21: 不要在不需要時引入變量(或常量)

ES.21: Don't introduce a variable (or constant) before you need to use it ES.21: 不要在不需要時引入變量(或常量)   Reason(原因) Readabil

原创 C++核心準則ES.23:優先使用{} 初始化器語法

ES.23: Prefer the {}-initializer syntax ES.23:優先使用{}初始化器語法   Reason(原因) Prefer {}. The rules for {} initialization are

原创 C++核心準則ES.25:如果沒有考慮修改對象的值,就將對象定義爲const或者constexpr

ES.25: Declare an object const or constexpr unless you want to modify its value later on ES.25:如果沒有考慮修改對象的值,就將對象定義爲cons

原创 用VisualStudio2019預覽版體驗C++20新功能

最近的連載中有很多內容涉及到C++20中的內容,例如concept等。但是由於C++20還屬於新生事物,不僅可以參考的例子少,找到一個可以體驗C++20功能的開發環境都困難。本文介紹使用微軟VisualStudio2019預覽版體驗C++

原创 永遠無法在游泳池裏學會海戰--《實戰Python設計模式》新書介紹

《實戰Python設計模式:實戰Python設計模式:可複用面向對象軟件開發實踐 》是本人根據自己在實際開發工作中積累的有關Python語言,設計模式的經驗,想法寫成的一本書,由電子工業出版社出版。謹此推薦給各位。 作爲可複用面向對象軟件

原创 C++核心準則ES.20: 保證所有對象被初始化

ES.20: Always initialize an object ES.20: 保證所有對象被初始化   Reason(原因) Avoid used-before-set errors and their associated und

原创 C++核心準則R.23: 使用make_unique構建unique_ptr

R.23: Use make_unique() to make unique_ptrs R.23: 使用make_unique構建unique_ptr   Reason(原因) For convenience and consistenc

原创 使用樹莓派構建嵌入式C++調試環境

本文以使用樹莓派4b爲例說明構建嵌入式C++執行環境。樹莓派本身可以到各大購物網站直接購買,價格大概300-500元不等。之所有選擇樹莓派是因爲它的系統比較完善,容易上手。但是需要實現說明的是本文說明的大部分內容並不僅限於樹莓派。   準

原创 C++核心準則ES.8:避免看起來差不多的名稱

ES.8: Avoid similar-looking names ES.8:避免看起來差不多的名稱   Reason(原因) Code clarity and readability. Too-similar names slow do

原创 C++核心準則ES.6:將循環變量和條件變量定義在限定範圍內

ES.6: Declare names in for-statement initializers and conditions to limit scope ES.6:將循環變量和條件變量定義在限定範圍內   Reason(原因) Re

原创 C++核心準則ES.1: 標準庫好於其他庫和手寫代碼

ES.1: Prefer the standard library to other libraries and to "handcrafted code" ES.1: 標準庫好於其他庫和手寫代碼   Reason(原因) Code us

原创 C++核心準則ES.2: 適當的抽象好於直接使用語言功能

ES.2: Prefer suitable abstractions to direct use of language features ES.2: 適當的抽象好於直接使用語言功能   Reason(原因) A "suitable ab

原创 C++核心準則R.36: 使用const shared_ptr(widget)&類型參數表示可能持有一個對象的引用計數

R.36: Take a const shared_ptr<widget>& parameter to express that it might retain a reference count to the object ??? R.