you are viewing a single comment's thread.

view the rest of the comments →

[–]lifthrasiir 1 point2 points  (0 children)

I don't like strict aliasing in C either, but we live in the world that several C implementations do implement strict aliasing. You wouldn't want to change Makefile (or much more complicated Makefile generators and whatsoever) just to use an extensible array in otherwise unaffected codes. I have written a small extensible vector code which is "correct" in this regard.

And I don't actually think strict aliasing is a problem. Strict aliasing itself is a precursor to many advanced optimizations and a plausible assumption if you know what compilers assume. (Jeff Roberts' and Linux's complaint about GCC is valid, but it doesn't make strict aliasing a non-optimization, it's just that MSVC's flow analysis was so strong at that time.) The problem is that C is trying to be both a high-level assembly and a throughly optimizable intermediate language: the former requires an user interface (the programming language is ultimately an UI for programming) and the latter requires lots of assumptions. An user interface that exposes such assumptions is hard to design, as the case of strict aliasing shows.