This post is about a cool piece of integer math code in folly::BucketedTimeSeries.| Lu’s blog
It is best to avoid accessing a function’s return value in a scope guard or we need to be really careful about the return value’s lifetime.| Lu’s blog
A program crashed during shutdown, with message pure virtual method called which came from __cxa_pure_virtual – where a pure virtual function points to, in its vtable. Its implementation involves calling std::terminate which calls std::abort which by default throws a SIGABRT, and crashing the program. Now, why did pure virtual method got called?| Lu’s blog
Lifetime in many ways are similar to types but also different. The goal of this post is to explain my mental model of rust’s lifetime binding works, when it takes place, and a trick to force late lifetime binding when needed.| Lu’s blog
I use zsh and yesterday I was testing a program with myprogram 2>/dev/null. In one iteration, I accidentally copied a newline character after the myprogram command and the zsh prompt looked something like| Lu’s blog
We rarely need to worry about lambda’s lifetime more than any other objects in C++ until we are dealing with coroutine at the same time. folly’s wiki has a good example of why we need to be careful about lambda’s lifetime – https://github.com/facebook/folly/blob/main/folly/experimental/coro/README.md#lambdas. The tl;dr is that when you have a lambda that returns a coroutine handle, we need to make sure the lambda itself outlives the coroutine handle.| Lu’s blog
I see folly::IOBuf often used as a return value (sub-)type in RPC definitions for data intensive and high performance applications. I looked at the code, and it says| Lu’s blog
C++’s inline is pretty nice, in my opinion. I define an inline function with external linkage, things work as expected (https://en.cppreference.com/w/cpp/language/inline):| Lu’s blog
I have eero at home with eero plus subscription as I like the parental controls. To my delight, the subscription also comes with DDNS. I wanted to set it up so I can ssh to my workstation from a laptop from our town library or a coffee shop.| Lu’s blog
Here is the section 3.5 of Nancy Lynch’s 1989 paper – A Hundred Impossibility Proofs for Distributed Computing, which is profound:| Lu’s blog
C++ coroutine is not a library that is ready to go (e.g. std::vector). It is not even a trait (think of Rust’s Future trait) that library writers or users can implement (or the compiler generates for you in the case of Rust). C++ coroutine is a specification that defines a set of customization points that library writers implement in order to get a functional coroutine.| Lu’s blog