[fpc-pascal] ansistrings, exceptions, pascal call stackand access violations
Peter Vreman
peter at freepascal.org
Wed Nov 3 22:26:13 CET 2004
> Peter wrote:
>
>>The problem is that the call to the empty ansistring routine will create
>> a
>>temp ansistring for the parameter. And ansistring variables or temps need
>>to be finalized. This call to finalize() destroyes the backtrace since it
>>writes at the same location in the stack that was also used by
>>test_division_by_zero. We can't solve easily.
>
> I was afraid it might be something like this! Interestingly, even if I
> move the test_division_by_zero function to be BEFORE the call to the
> do_nothing_with_an_ansistring function, I still get the same behavior --
> so it seems to be creating that temp ansistring param even before it gets
> to the call to the function that needs it. (( Perhaps this has something
> to do with threading or jumping or whatever you call it when the program
> starts a new task before it's finished with the old one in order to use
> resources efficiently. ))
It is not the creation of the temp ansistring, but the finalization at the
end of the procedure. This finalization is always done, also when there
was an exception.
More information about the fpc-pascal
mailing list