Are there compilers capable of suggesting optimizations that would absolutely require programmer approval?

My opinion is that allowing the optimizer to short circuit a function call just because a programmer thinks it would be ok, is a recipe for untracable bugs. Does it ask during each compile? I dunno; just sounds like there would be a lot of issues with something like this.

Oh, no. The assumption is that short-circuiting ALWAYS occurs, such as in C#. By "decide whether to short-circuit" I mean "a particular operand", by deciding to order it first or second in the expression.

The second expression will be short-circuited, whereas the first is always evaluated. – Triynko Dec 1 at 20:26 Ok, I think I get it now. – Almo Dec 1 at 20:32 It would of course check for potential optimizations during each compilation, and pool them in a list, like it does with compilation "warnings".

If the programmer makes a suggested change, then it obviously wouldn't be detected during the next compilation. Otherwise, it could just sit there forever like warnings do now. – Triynko Dec 1 at 20:33 Yeah, so I'm saying... "optimization of short-circuit expressions" is to decide the best order of operands, by putting FIRST the operands that are fastest/most-likely-to-trigger-a-short-circuit-of-the-latter-operands, and putting LAST the operands that are slower-running/more-desired-to-be-short-circuited.

– Triynko Dec 1 at 20:36.

" My thought, however, is more like this: " if we could do this we'd get much faster code, however, the semantics are different! We would have to strengthen the pre-condition of this function to do this optimisation. Is that OK?

" Strengthening a pre-condition may be OK, heck, the programmer probably didn't even write a pre-condition. If the programmers says "Sure, that's OK" and the programmer is wrong, then with any luck testing would reveal the problem with a "Pre-condition failure".

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions