[fpc-pascal] unit system; procedure move();
cervasio at airmail.net
Mon Mar 17 19:21:05 CET 2008
On Monday 17 March 2008 06:40:51 Jonas Maebe wrote:
> On 17 Mar 2008, at 12:34, fpc at xgelb.de wrote:
> > Is the use of the move procedure right? The array length is
> > Maximum-1. When I
> > put this length on value, the last entry value[Maximum-1] would
> > be deleted
> > or would be shifted in an different memory area?
> It would overwrite whatever is placed in memory after the array
> (which, in case there is nothing, indeed causes an access violation).
> Use this instead:
Wouldn't it be better to use the length function on the array? Or does that
not work in some compiler modes?
move(values, values, (length(values)-1) * sizeof(single));
If the size of the array is ever changed, no code change is required.
More information about the fpc-pascal