3 ms·
I agree that retrofitting existing codebase is a pain. Turning on strict aliasing is a mixed bag as programs that break when it's on are explicitly breaking th
by sharpneli 13y ago
I agree that retrofitting existing codebase is a pain.
Turning on strict aliasing is a mixed bag as programs that break when it's on are explicitly breaking the C spec. But one must make amends to support badly written legacy code. The official way to handle the aliasing across types is to use unions.
In my opinion the default behaviour in C should have been what restrict does. And a keyword to allow alias and yet another to allow aliasing across types, because unions are bit tedious to use. As an example float *aliased foo. And warnings when you cast normal pointer into aliased one or cast across types if the pointer is not aliased across types.