3 ms·
The point of the article is that the author wants compilers to tell users when they do unexpected things. I don't see how your point is relevant to that.
by TwoBit 7y ago
The point of the article is that the author wants compilers to tell users when they do unexpected things. I don't see how your point is relevant to that.
- bigcheesegs 7y agoThat may be the point, but it's not the premise. Even the title is based on this flawed idea. If the author wants to make a point, they can do so without trying to drive it with incorrect ideas.
- clarry 7y agoAnd the problem is that users ask the compiler to optimize, and then they complain because it optimizes. See, optimization can do a lot of unexpected things, but it is very difficult in general for the compiler to tell whether a certain application of (say) range analysis to eliminate dead code in a bunch of inlined calls is going to be unexpected. That's exactly the kind of optimization I want a compiler to do; I can write small functions that are as generic as possible yet cover all the edge cases, and then the compiler can find out which edge cases cannot apply in this particular situation. If the compiler told the user every time it did something, you'd never finish reading the output. Might as well ask the compiler not to optimize at that point.
- gpderetta 7y agoThe compiler doesn't know it is doing unexpected things. The compiler is doing what's expected given the axioms it has to work with. It would be nice if the compiler added assertions in place to validate that the axioms hold, but that would often be very expensive. Recently I have been using the sanitizers extensively and has been a huge improvement, but of course they are too expensive to leave on in prod. Would be nice if a cheaper, although less exhaustive version were available.