[fpc-devel] AllocMem(0)<>nil
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Mar 26 11:01:29 CET 2008
On 26 Mar 2008, at 09:55, petr.kristan at epos.cz wrote:
>>
>> On 25 Mar 2008, at 18:54, Vincent Snijders wrote:
>>
>>> Jonas Maebe schreef:
>>>> On 25 Mar 2008, at 18:30, Peter Vreman wrote:
>>>>> Current behaviour is compatible with TP7 that gave a valid pointer
>>>>> back pointing to heapend. See
>>>>> also the comment.
>>>> I thought so too, but I tested and TP7 stores nil in p when doing
>>>> getmem(p,0) (under DosBox).
>>>
>>> But AllocMem(0)?
>>
>> AllocMem does not exist in TP7. And the code posted by the original
>> poster comes from SysGetMem, not from AllocMem (which is just a
>> wrapper for getmem+fillchar).
> Yes. I tested GetMem and AllocMem in TP7.0, Delphi1, Delphi7, Kylix
> and
> all compillers returns nil when size is zero.
>
> This patch solves it.
Well, at the same time it breaks backwards compatibility with FPC. I
really don't remember anymore why we did things this way, but I'm
pretty sure there was a reason for it. Does anyone else remember?
Jonas
More information about the fpc-devel
mailing list