Category Archives: _Twitter Archive ๐Ÿค

Can we have non-atomic std::shared_ptr in C++?

Turns out, we do have them. libstdc++ contains a heuristic kludge where it checks if libpthread is linked into the process and conditionally executes an atomic add or non-atomic add depending on the result. Post 2020, it doesn’t directly use the libpthread hack, but uses glibc’s native support for this.

These kinds of things always make me sad about C++ (especially compared to how nice and clean things seem to be in Rust world), but at least it’s nice knowing that the committee did consider it and there are good reasons why to not have this in the C++ stdlib. The most compelling reason is that in the absence of a borrow checker, it is all too easy to silently use a non-atomic shared_ptr in multithreaded code.

Full thread:

Short thread about LLDB pretty printing internals

My audio development journey

Wrote a thread about it:

I get asked why I’m into C++ and not Rust.

I get asked why I’m into C++ and not Rust.

Above all, it’s pragmatic. C++ is simply what’s used for the work I aspire to do, and I don’t have time for both.

Beyond that, I still think there’s at least one reason to learn C++ today: out of respect for where it’s gotten us. A lot of lessons to learn from something that powers the world, flaws and all.

And when you do learn Rust, you’ll understand it better. The C++ context will give you a deeper & more intuitive appreciation for why it’s like it is.ย 

Rust wouldn’t be what it is without C++. ๐Ÿค

tweet:

git diff can natively detect code movement

An actionable framework for yearly goal planning

Evergreen tweets

Twitter’s length limit is deceptive. At a glance, it suggests that writing tweets should be easy and quick. This is true for superficial tweets, but does not mean all tweets are written quickly and with little effort.

Twitter is actually a platform for concise writing, and writing concisely is harder than writing verbosely. There are certain tweets I spend a lot of time on and it’s shame to have them get lost in my feed. So I’m storing them here.

Continue reading