C_quicknotes

Aug 8, 2022

Takeaways from the book “Advanced C Programming” by Berry, John Thomas.

While it’s titled “advanced”, it is rather basic. Here is some quick notes on stuff that I’m not familar with/ don’t use often.

Read more ...


List synchronization, from coarse-grained to non blocking wait-free

May 8, 2022

Concepts: Wait-free and Lock-free

An object impl. is wait-free if every thread completes a method in a finite number of steps:

  • NO mutual exclusion (thread should not halt in critical section)
  • NO while loop (that may keep spining..)

An object impl. if lock-free if in an infinite execution infinitely often some method call finishes(in a finite number of steps)

Read more ...




Pg_upgrade

Apr 24, 2022

TIFU by letting pacman upgrade the postgresql a major version (13->14). Then the postgresql service failed to start.. Anyways here is the fix.

also a nice thing in the AUR: the postgresql-old-upgrade package. It provides the binary for the older version of psql under/opt/postgresql{VERSION}

Read more ...

A (neo)vim IDE setup for C/C++, that just works

Apr 18, 2022
Honestly I don’t think over-functional completion and diagnostics give you any productivity. The same is true for highlighting: if you highlight everything, you highlight nothing. It’s a harmful mentality to think “oh I have to have the best tools before I get started.” No, tool is just tool, the purpose is production. So this is what I want: basic syntax highlighting. completions based on current project. jump to definition. <–!more–> Essential tools/plugins Deoplete for completion framework Read more ...

Const Expression in c++

Apr 11, 2022

NOTE: this is just copy-pasting from stackoverflow and some textbooks, see references below.

  • 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.

You should read from right to left. This is refered to as clockwise/spiral rule

  • int * pointer to int
  • int const * == const int * pointer to const int
  • int * const const pointer to int
  • int const * const == const * const const pointer to const int

and …

  • int ** pointer to pointer to int
  • int ** const const pointer to pointer to int
  • int * const * pointer to const pointer to int
  • int const ** pointer to pointer to const int
  • int * const * const const pointer to const pointer to int.
Read more ...

Deconstruct

Mar 10, 2022

过度的、纯粹的解构会脱离人的本能理解,以至于解构本身需要与一个解释捆绑在一起才能具有意义,于是,解构反而成为了一个新的构筑。

现代艺术从经验主义和形式主义的束缚(比如:你必须画得像,做得真),转向了一种新的束缚:符号是摆脱了细节的抽象,但他必须由环境,语言,历史,社会赋予意义。

Read more ...