Re: [fpc-devel] an observation about GetMem

2008-09-05 Thread Michael Schnell
Peter Popov wrote: As I was porting things from delphi to fp today I noticed the following difference: Delphi (2,5) : GetMem(p, 0) will set p to nil. FPC (2.2.2, 2.3.1) : GetMem(p, 0) will assign something to p Should it be forbidden do allocate a buffer of size 0 and reallocate it

Re: [fpc-devel] an observation about GetMem

2008-09-05 Thread Micha Nelissen
Peter Popov wrote: Well, if it points to something, then there is space, isn't it? Unless it is clearly mentioned in the documentation that GetMem(p,0) results in You get a pointer to some place where you may store 0 bytes, so nothing :-). This can be useful because otherwise you may think

Re: [fpc-devel] an observation about GetMem

2008-09-05 Thread Peter Vreman
Peter Popov wrote: Well, if it points to something, then there is space, isn't it? Unless it is clearly mentioned in the documentation that GetMem(p,0) results in You get a pointer to some place where you may store 0 bytes, so nothing :-). This can be useful because otherwise you may think

Re: [fpc-devel] FPC 2.2.2 on Linux/SPARC

2008-09-05 Thread Mark Morgan Lloyd
Jonas Maebe wrote: On 03 Sep 2008, at 22:23, Jonas Maebe wrote: Yes, you did. Thanks. The bug is indeed in fillchar in generic.inc: { Align on native pointer size } aligncount:=(PtrUInt(pdest) and (sizeof(PtrUInt)-1)); dec(count,aligncount); pend:=pdest+aligncount; That

Re: [fpc-devel] an observation about GetMem

2008-09-05 Thread Peter Popov
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

Re: [fpc-devel] Unicodestring branch, please test and help fixing

2008-09-05 Thread Martin Schreiber
Florian, On Saturday 30 August 2008 13.37:42 Florian Klaempfl wrote: I've continued to work on support of an unicodestring type in fpc. It's currently in an svn branch at: http://svn.freepascal.org/svn/fpc/branches/unicodestring and will be merged later to trunk. The unicodestring type is a

Re: [fpc-devel] Unicodestring branch, please test and help fixing

2008-09-05 Thread Florian Klaempfl
Martin Schreiber schrieb: Florian, On Saturday 30 August 2008 13.37:42 Florian Klaempfl wrote: I've continued to work on support of an unicodestring type in fpc. It's currently in an svn branch at: http://svn.freepascal.org/svn/fpc/branches/unicodestring and will be merged later to trunk. The