Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread David Emerson
I *am* checking sizes before the move, which is why it surprised me that things were going out of bounds -- the trouble is I forgot the array index [0] On Sat 24 Apr 2010, Martin wrote: > On 24/04/2010 22:01, Andrew Brunner wrote: > > David, > > > > I don't see how you are not getting memory leak

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread Martin
On 24/04/2010 22:01, Andrew Brunner wrote: David, I don't see how you are not getting memory leaks by doing a move before making sure that the destination buffer has the memory allocated. You see, in Delphi and FPC, move d/n actually move the memory... It just copies it. You were warned :-) O

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread Andrew Brunner
David, I don't see how you are not getting memory leaks by doing a move before making sure that the destination buffer has the memory allocated. You see, in Delphi and FPC, move d/n actually move the memory... It just copies it. You were warned :-) On Sat, Apr 24, 2010 at 3:01 PM, David Emerson

[fpc-pascal] DirectFB 1.2.7 support available + question about fpc wiki

2010-04-24 Thread Roland Schaefer
a release of directfb bindings with support for both 1.4 and (new) 1.2.7 binaries (as included in ubuntu karmic, for example) is now available: http://sourceforge.net/projects/wiseslap/files/ (look for: 'fpc-directfb-1.4+1.2.7.tar.gz') anyone wishing to experiment with directfb on a standard deskt

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread David Emerson
cobines wrote: > David Emerson wrote: > > move (src.f_data, self.f_data, length(self.f_data) * sizeof(byte)); > > I think it should be: > > SetLength(self.f_data, length(src.f_data)); > move (src.f_data[0], self.f_data[0], length(self.f_data) * sizeof(byte)); Well, the setlength is not necessary

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread cobines
2010/4/24 David Emerson : > move (src.f_data, self.f_data, length(self.f_data) * sizeof(byte)); > I think it should be: SetLength(self.f_data, length(src.f_data)); move (src.f_data[0], self.f_data[0], length(self.f_data) * sizeof(byte)); -- cobines ___

[fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread David Emerson
I have a class that has a field, f_data : array of byte; // a dynamic array Within a method of this class (which takes as a parameter "src", another instance of the class) I have the following code: move (src.f_data, self.f_data, length(self.f_data) * sizeof(byte)); It appears that this move

Re: [fpc-pascal] newbie questions

2010-04-24 Thread Marc Weustink
spir ☣ wrote: On Tue, 20 Apr 2010 01:17:51 +0200 Marc Weustink wrote: Somehow I get the idea that you mix the definition/use of sets with arrays. Yes, it seems Pascal sets are rather related to enums than collections. I mean they look like packs of kinds of flags, which themselves are named