Skip to content

Robert Christensen

Game Programmer

  • Home
  • Projects
  • Blog
  • Resume
  • Contact

Cursed code

“Wow, why would you ever want to do that?”

These ill-advised snippets come with absolutely no warranty–not for your program, not your OS, and certainly not your sanity when debugging. And if you use it in production, not for your job either. It’s a small miracle that they work anywhere near as reliably as they do given how much UB there is.

Cursed C++: reinterpret_cast (yes, all of it)

06/08/202511/13/2024 by Robert

For a standard feature, it’s staggeringly easy to misuse and cause undefined behavior. So what does the standard guarantee it really can do?

Categories Home Post, Process Posts Tags C++, Cursed code, Sanable

Cursed C: Hijacking access violations

10/02/202504/22/2024 by Robert

Demystifying SEGFAULT, and using standard C functions to resume execution for a limited time. Resource leaks are the least of our concerns when undefined behavior and instability await!

Categories Home Post, Process Posts Tags C, C++, Cursed code

Cursed C++: public_cast

10/02/202502/07/2024 by Robert

Ever needed to use some obscure library function only for it to be private?

Meet public_cast, an abomination unto good code that can see almost everything. Did I mention it’s entirely compliant with the C++ standard?

Categories Home Post, Process Posts Tags C++, Cursed code, Sanable
© 2026 Robert Christensen • Built with GeneratePress