Cursed C++ Casts
Join me for an October scary story as we try to find the identity of the scariest C++ cast. The original inspiration for implementing public_cast came from here. I wrote my own version which is more modern and (IMHO) easier to understand, but I take no credit for the ingenuity (and devilishness) of the basic implementation technique. https://github.com/libretro/bnes-libr... After uploading the video, I realized you could use a trait type, something like public_cast_traits, and specialize it with CxSecret to "store" the member pointer type (int C::*) once, and then just look it up inside public_cast, so you don't have to repeat it at every "call site." That's one possible solution for the part where I said to let me know if you have any ideas. implicit_cast can be found in boost: https://www.boost.org/doc/libs/1_79_0... Other stuff: evil floating point bit level hacking: https://en.wikipedia.org/wiki/Fast_in... Strict Aliasing: https://gist.github.com/shafik/848ae2... I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity. https://www.manim.community/ https://www.blender.org/ https://www.audacityteam.org/

Two Ways To Do Dynamic Dispatch

Verse: A New Scripting Language? In THIS Economy?

Moves Are Broken

going fast is about doing less

Your VM Is Just a Linux Process

Math News: The Additivity Conjecture in Knot Theory is FALSE!

Rust Functions Are Weird (But Be Glad)

C Strings are Terrible!

Stop using std::vector wrong

Constructors Are Broken

The Dark Side of .reserve()

Choose the Right Option

MOST COMMON Programming Mistakes

I Trapped A Scammer For 12 Days (he's furious)

I Wrote my Own Filesystem to Beat Factorio.

Forbidden C++

C++ vs Rust: which is faster?

RollerCoaster Tycoon Optimizations are Insane

The ONLY C keyword with no C++ equivalent

