Tech article
Type Punning in C and C++
No preview is available. Read the original article for the full story.
Hacker News | Sep 22, 2026 | ingve
Automated excerpt
In C, the safe ways to type pun are union and memcpy. The compiler sees that u64 is uint64_t* and c is struct c* — different types — so it assumes they don’t alias. If you’re writing C and need to type pun, use a union or memcpy.
Selected automatically from source text; not independently written or fact-checked. Read the original for full context.