On 11 Jul 2001, at 13:34, Frank Heckenbach wrote:
[...]
You can use a GPC extension of {$define}. Put at the beginning of your source file these lines; {$ifdef __GPC__} {$define Getmem(x,y) New(x,y)} {$endif}
Then you can use 'Getmem' as usual, and GPC will substitute 'New' for it. Note that this is not visible outside the source file in which it was declared, so if you want to do the same in another file, you have to add those lines to that other file as well.
But that's not the same. The second parameter to New for schemata designates the number of elements whereas the second parameter to GetMem specifies the number of bytes. You might not immediately notice if you allocate as many elements as you meant to allocate bytes -- except by wasting some memory. ;-)
Yes, I see that now. It seems that he may just have to use {$ifdef} to switch between New and Getmem, or to use Getmem and then, with GPC, to set the capacity of the strings before assigning any value to them. But setting the capacity manually (e.g., "a^[i].capacity := 8") is not advisable - right? In which case we are back to the first alternative.
Best regards, The Chief --------- Prof. Abimbola Olowofoyeku (The African Chief) Author of Chief's Installer Pro for Win32 Email: African_Chief@bigfoot.com http://www.bigfoot.com/~african_chief/