[fpc-devel] an observation about GetMem

Peter Popov ppopov at tamu.edu
Fri Sep 5 18:25:30 CEST 2008


>> You get a pointer to some place where you may store 0 bytes, so nothing  
>> :-).
>>
>> This can be useful because otherwise you may think the allocation failed
>> if you get nil back. (And you've disabled heap exception).

you have a point

>
> In FPC it is done by design. If 0 bytes are asked we allocate at least  
> the minimum alignment to
> get a valid pointer. This is done for compatibility with TP7.0 that  
> returns the value of heapptr
> which is also a valid pointer.
>

Thanks for the clarification!
I guess if you switch to reallocmem entirely, there will be delphi  
compatibility, yes?

Peter



More information about the fpc-devel mailing list