[fpc-pascal] ReAllocMem problem (?)
mm10 at ellipsa.net
Sat Mar 12 23:40:55 CET 2005
Micha Nelissen wrote:
>In this case I would advise not to free the pointer and explicitly document this choice in the freepascal documentation. (As the user can free the area himself anyways, but can not bring it back).
>Maybe it would help you more to allocate more space in advance? Or use a data structure not requiring reallocations ? Just some suggestions...
Your are right, it would be faster but this is not possible. For
instance, suppose you are a user of the library and you want to
compute !10000, i.e., Factorial 10000. Currently, all you have
to do is to write "IFactorial(N,10000)". Now what if, before
calling IFactorial, it is necessary to estimate the size of
!10000 in order to oversize N? Yes, you lovely archive the
library in the trush and you search for an other one :-)
More information about the fpc-pascal