[fpc-pascal] GetMem should use out parameter ?

mm m2 at ellipsa.net
Wed Aug 22 16:48:46 CEST 2007


Skybuck Flying a écrit :
> Hello,
> 
> Does GetMem care about the memory contents of the pointer variable ?
> 
> If not the parameter should be out instead of var to prevent the 
> following hint message:
> 
>  GetMem( node, sizeof(Tnode) );
> 
> Y:\Free Pascal\Units\Technical\TnodeList\version 0.08 port to free 
> pascal\unit_TnodeList_version_009.pas(1015,3) Hint: Variable "node" does 
> not seem to be initialized
> 
> GetMem could fail if out of memory, Delphi raises an OutOfMemory Exception.
> 
> What does Free Pascal do ?

I believe it depends on the global variable "ReturnNilIfGrowHeapFails".
When it is false, FPC behaves like Delphi.

mm



More information about the fpc-pascal mailing list