[fpc-pascal] ptop and comma.

Tomas Hajny XHajT03 at hajny.biz
Sun Feb 23 23:22:16 CET 2020


On 2020-02-23 15:26, fredvs via fpc-pascal wrote:


Hi,

> OK, I opted for changing in procedure Tjtop.Usage(ECode: word);
> 
>   halt(Ecode); //------> This produces a memory leak
> 
> with
> 
>  terminate; // ------> No nore memory leak.

This makes no sense from my point of view. Halt finishes execution of 
the program. At that point, all memory previously allocated to that 
program should be returned to the operating system (at least standard 
operating systems do so), thus the leak may make no difference. The 
difference between your version and the original one is that the 
original finishes the program with some error code thus allowing some 
error checking in case the program was called from some script, etc., 
whereas your version finishes with a result of 0 even if the processing 
encountered some errors.

Tomas


More information about the fpc-pascal mailing list