> 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 the allocation failed > if you get nil back. (And you've disabled heap exception).
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. Peter _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
