Comment

Comment by jcranmer

> There has been an ever increasing creep of undefined behaviour, which has broken existing code - type punning through unions was literally the “correct” mechanism for type coercion, which then became invalid when they established new, questionable, type aliasing rules that rendered it UB.

Punning through unions is well-defined behavior in C99 and C11. In C++11 and newer, it's questionable, but it works in practice.

parent jcranmer 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton