Const Expression in c++

Jun 6, 2020

ref: A tour of C++

  • const: meaning roughly “I promise not to change this value.” This is used primarily to specify interfaces so that data can be passed to functions using pointers and references without fear of it being modified. The compiler enforces the promise made by const. The value of a const can be calculated at runtime.

  • constexpr: meaning roughly “to be evaluated at compile time.” This is used primarily to specify constants, to allow placement of data in read-only memory (where it is unlikely to be corrupted), and for performance. The value of a constexpr must be calculated by the compiler.

Read more ...

Vim tab&buffer confusion

May 30, 2020

For so long, i have been using vim tabs the wrong way …

It is BUFFER, instead of TAB, that works as a file proxy, especially when editing multiple files. TAB is a layout and WINDOW/SPLIT is a viewpoint into a BUFFER. TAB and WINDOW could by no mean represent a file in their very nature.

Read more ...

Add katex support to Hugo

May 29, 2020

Recently I decide to post some math notes on the blog, so here is how to add math formula rendering support to hugo. Actually it’s as simple as adding several lines to Hugo’s theme file.

Read more ...