4 ms·
I guess now compilers will give warnings (and later errors) for usages that are pointless?
by antisemiotic 7y ago
I guess now compilers will give warnings (and later errors) for usages that are pointless?
- mehrdadn 7y agoThey could already do that though?
- antisemiotic 7y agoBut now if anyone complains about such errors you can throw the standard at them.
- FartyMcFarter 7y agoWhat is an example of using volatile that the compiler can conclude is pointless? I find it hard to imagine non-contrived examples, since the point of volatile is to tell the compiler "don't assume or optimize any access to this variable - entities unknown to you can read/write it at any moment". If the compiler can't make such assumptions, how can it diagnose whether there's a point or not?
- antisemiotic 7y agoThere are some examples mentioned in the link, like volatile non-pointer non-reference variables. This can't be used for the real purpose of volatile (memory-mapped IO, etc) and could only result from someone confusing volatile with atomic, so it's safe to deprecate these.