3 ms·
How can the standard be wrong? Is what it says about aliasing unclear, impossible to implement, or what?
by ramshorns 8y ago
How can the standard be wrong? Is what it says about aliasing unclear, impossible to implement, or what?
- platinumrad 8y agoThe 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 https://blog.regehr.org/archives/1307 http://www.yodaiken.com/2018/05/20/depressing-and-faintly-terrifying-days-for-the-c-standard/ http://www.yodaiken.com/2018/05/20/depressing-and-faintly-te... https://blog.regehr.org/archives/903 https://blog.regehr.org/archives/903 (See the end of Xavier Leroy's comment)