> The union punning trick is UB in C89 and well-defined in C99 and later, although it was erroneously listed in the (non-normative) Annex listing UBs in C99 (removed by C11).
Right, that's my point. If the standard folks can't understand their standard, how are mere mortals supposed to?
> Strict aliasing is another category of UB that I'd consider gratuitous.
I'm of a bit split minds on it. It can yield substantial speedups. But is also impractical in a lot of cases. And it's often but strong enough anyway, requiring explicit restrict annotations for the compiler to understand two pointers don't alias. Turns out two pointers of the same (or compatible) type aren't rare in performance critical sections...
Right, that's my point. If the standard folks can't understand their standard, how are mere mortals supposed to?
> Strict aliasing is another category of UB that I'd consider gratuitous.
I'm of a bit split minds on it. It can yield substantial speedups. But is also impractical in a lot of cases. And it's often but strong enough anyway, requiring explicit restrict annotations for the compiler to understand two pointers don't alias. Turns out two pointers of the same (or compatible) type aren't rare in performance critical sections...
Realistically it should have been opt-in.