[r6rs-discuss] [OT] Should compilers preserve termination?
Ludovic Court?s wrote:
> How would you notice that a side-effect-free loop has been optimized
> away? I believe you can't.
>
If it should loop more than, say 1e20 times, it is quite easy to notice
whether it is optimized away or not;-) Especially infinite loops are
easy to distinguish from no loop at all.
Actually, part of the problem is to define what a side effect is.
Suppose I have a loop that allocates (and releases) memory with some
pattern. It has no effect whatsoever on the meaning of the program but
it can be quite useful to test the effectiveness of a garbage collection
implementation. Similar things have been used to send messages between
processes that were supposed to be totally isolated from each other. The
way your operation system handles the essentially side-effect free "idle
loop" when no processes are running is directly related to how long your
laptop will run on battery.
But yes, we are getting off topic...
/Mikael
Received on Mon Mar 12 2007 - 08:21:10 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC