Liste des Groupes | Revenir à cl c |
On 23/03/2024 16:25, David Brown wrote:That is trivially true. I was picking a simple example and showing how difficult it is to try to define a language where "the compiler does exactly what I tell it to do". If it is that difficult to define the programmer's precise expectation of the behaviour of "x++;" at the lowest level, how could we hope to do it with anything like the OP's case?On 23/03/2024 01:09, Kaz Kylheku wrote:On 2024-03-22, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:This is not the issue the comes up in the OP (or the issue that was assumed as I don't think the OP has clarified).>I'm not aware that any such language exists, at least in the mainstream
(and I've looked at a *lot* of programming languages). I conclude that
there just isn't enough demand for that kind of thing.
I think lack of demand combines with it actually being an extremely difficult task.
>
Consider something as simple as "x++;" in C. How could that be implemented? Perhaps the cpu has an "increment" instruction. Perhaps it has an "add immediate" instruction. Perhaps it needs to load 1 into a register, then use an "add" instruction. Perhaps "x" is in memory. Some cpus can execute an increment directly on the memory address as an atomic instruction. Some can do so, but only using specific (and more expensive) instructions. Some can't do it at all without locking mechanisms and synchronisation loops.
>
So what does this user of this mythical LLL expect when he/she writes "x++;" ?
There it is not about micro-managing the implementation of x++, but the compiler deciding it isn't needed at all.First you have to decide /exactly/ what you mean by "x++;", before you can decide if it is valid to remove it or not.
Les messages affichés proviennent d'usenet.