roxen.lists.pike.general

Subject Author Date
Re: MutexKeys, garbage collectors, destructors and optimisers Stephen R. van den Berg <srb[at]cuci[dot]nl> 03-02-2009
Martin Stjernholm wrote:
>"Mirar @ Pike  importm??te f??r mailinglistan" <<6341[at]lyskom.lysator..liu.se>>
skrev:
>> would probably give a tail recursion optimization, releasing the local
>> variables of the function fun() first and then call some_call(),
>> dropping fun()'s stackframe before calling.

>Yes, that's probably the reason. Although I vaguely recall that the
>tail recursion optimization treats this case correctly nowadays, so it
>shouldn't be necessary. Can't say for sure though, but it's easy to
>try out.

I've said this before, but it yet again shows that it would be rather
desirable to get semantics on the moment destructors are called which
coincide with when C++ calls them (at the logical end of a block).
It's quite unfortunate that you need to know how the optimiser works to
ensure that certain side-effects in destructors are performed not too
soon or too late.
-- 
Sincerely,
           Stephen R. van den Berg.

"My best friend ran away with my wife.  I miss him."