Emacs internals: Tagged pointers vs. C++ std:variant and LLVM (Part 3)

thecloudlet 66 points 31 comments March 12, 2026
thecloudlet.github.io · View on Hacker News

Discussion Highlights (4 comments)

thecloudlet

Emacs internal part 2 HN link: https://news.ycombinator.com/item?id=47259961

tialaramex

It's not clear to me (and as an unsafe language it's not called out by your compiler if you do something illegal) what the correct way to spell this kind of trick is in C++ I had thought you need the pointer-sized integer types and mustn't do this directly to an actual pointer, but maybe I was wrong (in theory, obviously practice doesn't follow but that's a dangerous game)

ndesaulniers

Happy to see discussion of LLVM's interesting implementation of Static Polymorphism using CRTP. Some recommended reads: 1. https://en.wikipedia.org/wiki/Curiously_recurring_template_p... 2. https://david.alvarezrosa.com/posts/devirtualization-and-sta... 3. https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-an...

mshockwave

LLVM now has another way to implement RTTI using the `CastInfo` trait instead of `classof`: https://llvm.org/doxygen/structllvm_1_1CastInfo.html But it's really just an implementation difference, the idea is still to have a lightweight RTTI.

Semantic search powered by Rivestack pgvector
3,471 stories · 32,344 chunks indexed