[fpc-devel] GetMem(SomePointer, 0) <> nil

Michael Van Canneyt michael at freepascal.org
Tue Mar 1 13:20:19 CET 2011



On Tue, 1 Mar 2011, Paul Ishenin wrote:

> Hello, FPC developers' list.
>
> I noticed today that if I want to allocate 0 bytes I get not a nil but a 
> valid pointer. Why?
>
> This is incompatible with delphi. And I suppose cause crashes and memory 
> leaks not only in my delphi code which I'm porting to FPC/Lazarus.

Well, in all these years, you're the first to notice, 
so I'm not inclined to think it is a big problem.

Does it say in the Delphi docs that Nil is returned if Size=0 ?

Michael.



More information about the fpc-devel mailing list