It has been pointed out that recognizing and replacing a bubble
sort with a quick sort may not always be in the best interest
of a given application. I don't agree that C compilers have the
right to argue with the application developer over their choice
implementation algorithm.
I guess I wondered where you were coming down.
The C language as defined by its standards gives compilers
a reasonable amount of freedom to translate applications
as written to the executable machine code. To give a
compiler the additional flexibility to select appropriate
application implementation algorithm at the function level
requires a language designed to describe application
objectives rather than implementation.
As I said, I was following the 'thread' of responses downward
from Hans-Bernhard Bröker's comment. I assumed (wrongly)
that you were addressing yourself along similar lines.
Regarding your assertion here about what a c compiler is
permitted to do and not, I'm not an expert on the subject. I
am merely "somewhat dangerous" and I will defer to your (and
those of others similarly experienced) opinion about it, for
now. You are in far better position than I am to speak to
this.
To illustrate this point. Your exact timing example is not a
C compiler limitation but a language limitation. How do
you describe exact timing all paths in a function in an
unambiguous way in C? Exact timing is an application
objective.
Of course it is. But if you've read the Bulldog thesis (and
I assume you have -- who hasn't who works on compilers? --
even I've read it thoroughly and enjoyed it and I'm merely a
hobbyist on the matter, if that much), you will see how those
kinds of "goals" (as well as other "clues") were provided a
suggested implementation (because it was _actually_
implemented.)
It's possible to extend c for embedded use here just as it
has always _been_ extended. Ad hoc methods. #pragma being a
somewhat "allowable" method among others.
....
I am now left wondering what you meant in the post I first
responded to. I'll have to go reread it again, taking into
account the new information here and see if I can see how it
fits with Mr. Bröker's comments, too.
Jon