Re: [fpc-pascal] Move() vs MemCopy()

2009-09-30 Thread Hans Mårtensson
Graeme Geldenhuys wrote: 2009/9/29 Vincent Snijders : I never thought that mov ax, bx (8086 assembler) would clear the register after the move. If you put it like that, it never (for some strange reason) confused be either. :-) I guess that's probably because everything in assembler c

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > 2009/9/29 Florian Klaempfl : >> Indeed, the serious answer is: >> move handles overlapping memory blocks correctly (so the data might not >> existing anymore at the old location), memcpy doesn't do this and screws >> things up when handling overlapping blocks. This is w

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Vincent Snijders : > > I never thought that > mov ax, bx (8086 assembler) > would clear the register after the move. If you put it like that, it never (for some strange reason) confused be either. :-) I guess that's probably because everything in assembler confused me, so nothing stood o

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Graeme Geldenhuys : > > Could this "alias" procedure be applied somewhere in FPC?  This was > done before - the case of AssignFile() vs Assign() > > procedure MemCopy(src, dest: pointer; size: SizeInt); > begin >  Move(src^, dest^, size); > end; here is an improved MemCopy(), with the s

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Vincent Snijders
Marco van de Voort schreef: In our previous episode, Graeme Geldenhuys said: No. So why is the function called MOVE instead of COPY? :-) Historical reasons apparantly. I never thought that mov ax, bx (8086 assembler) would clear the register after the move. So I never thought that mo

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Florian Klaempfl : > > Indeed, the serious answer is: > move handles overlapping memory blocks correctly (so the data might not > existing anymore at the old location), memcpy doesn't do this and screws > things up when handling overlapping blocks. This is why e.g. C++ has > memmove as we

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Florian Klaempfl
Jonas Maebe schrieb: > > On 29 Sep 2009, at 15:46, Graeme Geldenhuys wrote: > >> Windows has 'memcpy()', not 'memcopy()' ;-) > > memcpy() is from the C library. And the C library also has memmove(), > for that matter. > > The difference between memcpy() and memmove() is that memcpy() has > un

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > 2009/9/29 Florian Klaempfl : >> Because it doesn't copy your ram modules ;) > > Well, if I move something (no matter what it is), it doesn't exist in > the original location any more. Hence my confusion about the Move() > procedure. Indeed, the serious answer is: move

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: > > No. > So why is the function called MOVE instead of COPY? :-) Historical reasons apparantly. > I grep searched the *full* FPC source and found a implementation of > MemCopy() in the packages/pasjpeg/* directory... So it seems to > confirm

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Jonas Maebe
On 29 Sep 2009, at 15:46, Graeme Geldenhuys wrote: Windows has 'memcpy()', not 'memcopy()' ;-) memcpy() is from the C library. And the C library also has memmove(), for that matter. The difference between memcpy() and memmove() is that memcpy() has undefined behaviour if the source an

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Florian Klaempfl : > > Because it doesn't copy your ram modules ;) Well, if I move something (no matter what it is), it doesn't exist in the original location any more. Hence my confusion about the Move() procedure. Regards, - Graeme - __

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Michael Van Canneyt : > > Because move predates memcopy. memcopy is a windows function. > Move existed in the system unit of TP even before windows existed. Windows has 'memcpy()', not 'memcopy()' ;-) As for the origins of Move(), I can't comment except to say that the original au

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > 2009/9/29 Marco van de Voort : >> No. > > > So why is the function called MOVE instead of COPY? :-) Because it doesn't copy your ram modules ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.free

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Michael Van Canneyt
On Tue, 29 Sep 2009, Graeme Geldenhuys wrote: 2009/9/29 Marco van de Voort : No. So why is the function called MOVE instead of COPY? :-) Because move predates memcopy. memcopy is a windows function. Move existed in the system unit of TP even before windows existed. Michael. _

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Marco van de Voort : > > No. So why is the function called MOVE instead of COPY? :-) I grep searched the *full* FPC source and found a implementation of MemCopy() in the packages/pasjpeg/* directory... So it seems to confirm what you (Marco) said. MOVE = MEMCOPY.It that case, M

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: > I'm still porting code from SpeedSoft's Pascal compiler. The code I am > porting often uses MemCopy(), but Free Pascal doesn't seem to have > such an implementation. So I looked at the next best thing... Move() > > But as the name suggests (...Mov

[fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
Hi, I'm still porting code from SpeedSoft's Pascal compiler. The code I am porting often uses MemCopy(), but Free Pascal doesn't seem to have such an implementation. So I looked at the next best thing... Move() But as the name suggests (...Move()...), I would have expected it to actually move the