Type Punning in C and C++

·Hacker News··

I had a bug that took me a while to track down. The problem was type punning. A pointer cast worked fine at -O0 and silently broke at -O2. The C vs C++ distinction here is genuinely treacherous, and most blog posts on the topic get it wrong.

Read full article →

Related Articles

NASA’s Mars Sample Return mission is dead
Muhammad523 · Hacker News · 18h ago
AMD's random number generator can't generate a 0?
BruceEel · Hacker News · 5h ago
What happened to the Snowden archive
EXHades · Hacker News · 1d ago
Samsung is expected to more than double output of its HBM4 and HBM4E DRAM
giuliomagnifico · Hacker News · 1d ago
MiMo-v2.6-Pro: Intelligence, Performance and Price Analysis
theanonymousone · Hacker News · 10h ago