Cursed C++: reinterpret_cast (yes, all of it)
For a standard feature, it’s staggeringly easy to misuse and cause undefined behavior. So what does the standard guarantee it really can do?
Game Programmer
“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.
For a standard feature, it’s staggeringly easy to misuse and cause undefined behavior. So what does the standard guarantee it really can do?
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!
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?