Re:Torvalds: Standards need to be questioned
by ramshorns on Tuesday June 05, 2018 @06:30PM
(#17242655)
How can the standard be wrong? Is what it says about aliasing unclear, impossible to implement, or what?
[ Parent
| on HN ]
Re:Torvalds: Standards need to be questioned
by platinumrad on Tuesday June 05, 2018 @07:24PM
(#17243036)
The standard massively conflicts with the practices used in existing C programs by existing C programmers. Yes, it's perfectly possible to write code that doesn't violate any of the (largely implicit, it's worth noting) strict-aliasing rules. But was it a good idea for the standard to allow optimizing compilers to silently break massive amounts of existing code that has worked for years? Even if that were acceptable, was it a good idea for the standard to disallow one of the more ergonomic and explicit ways (using a union) of reinterpreting an object as an object of a different type?
Some good reads on this topic:
https://blog.regehr.org/archives/1307
http://www.yodaiken.com/2018/05/20/depressing-and-faintly-te...
https://blog.regehr.org/archives/903 (See the end of Xavier Leroy's comment)