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

Vinzent Höfler JeLlyFish.software at gmx.net
Tue Mar 1 22:58:33 CET 2011


On Tue, 01 Mar 2011 22:19:38 +0100, Micha Nelissen <micha at neli.hopto.org>  
wrote:

> Paul Ishenin wrote:
>> 01.03.2011 19:29, Jonas Maebe wrote:
>>> That sounds very much like badly written code.
>> For simplicity we had the next code:
>>  GetMem(SomeArray, Count * SizeOf(ArrayCell))
>>  if SomeArray <> nil then DoSomeLogic;
>
> DoSomeLogic ... with a Count = 0, right? or was Sizeof(...) = 0? :-)

What I wonder is, if GetMem returns a non-NIL, valid pointer for a request
of zero bytes of memory, where does this pointer actually point to? ;)


Vinzent.



More information about the fpc-devel mailing list