4 ms·
I believe you have been using a definition of Friendly C, as seen here: http://blog.regehr.org/archives/1180 http://blog.regehr.org/archives/1180. I wasn't awa
by dsfuoi 10y ago
I believe you have been using a definition of Friendly C, as seen here: http://blog.regehr.org/archives/1180 http://blog.regehr.org/archives/1180.
I wasn't aware of that and my idea of it is different.
Aliasing rules help the compiler decide what values have to be reloaded. The stricter those rules less chance there is for pointers to alias the same memory.
- pcwalton 10y agoNo argument there. I'm a fan of strict-aliasing optimizations. :)
- nkurz 10y agoFor possible clarity, despite arguing against "unwanted" optimizations, I'll mention that I'm also in favor of strict aliasing. That's the sort of optimization I like, especially if it's "opt-in" by specifying -std=c99 or -std=c11. It's unlikely to happen and probably not wise, but my personal preference for future standards would be to invert the "restrict" paradigm, and assume that even same-type writes never alias unless "may_alias" or some-such is specified.