[fpc-pascal] how to use Default to replace this " FillChar(aRecord, sizeof(aRecord), 0);

2016-12-04 Thread Dennis
In this old statement, I don't need to know the type of aRecord but if I want to use Default, I have to know the exact type of the varaible aRecord and pass it to Default(aRecordType) e.g. aRecord := Default(aRecordType) //where var aRecord : aRecordType Is it possible to use default

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Florian Klämpfl
Am 04.12.2016 um 11:25 schrieb Graeme Geldenhuys: > > My worry about Generics is the following statement in the fgl.pp unit: > > " > { be aware, this unit is a prototype and subject to be changed heavily } > " > > So that tells me this is not to be used in production software as it is > more

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Sven Barth
Am 04.12.2016 11:25 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > Then you should have a look at TFPGList, even if you do not like > > generics. TFPGList is our approach to extend FPC carefully with generics. > > At the moment I'm using FPC 2.6.4 for the work I'm doing. I can't

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: > If I use an array to hold a list of say Integers. Is there any serious > performance penalty for resizing (growing) the dynamic array as I add > items. My point being, I don't know the number of elements I'll need > beforehand. Yes, ordered

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Graeme Geldenhuys
On 2016-12-04 14:48, Adriaan van Os wrote: > It depends on the memory manager you use,... Wow, that's some interesting information there. Thanks for sharing. > There is nothing 80's or 90's about intelligent and advanced data structures. I simply meant, back in the day when I learned Turbo

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Adriaan van Os
Martin Schreiber wrote: On 12/04/2016 11:28 AM, Graeme Geldenhuys wrote: Hi, If I use an array to hold a list of say Integers. Is there any serious performance penalty for resizing (growing) the dynamic array as I add items. My point being, I don't know the number of elements I'll need

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Graeme Geldenhuys
On 2016-12-04 14:10, Dmitry Boyarintsev wrote: > You'll also need to store the actual size somewhere next to the dynamic > array, since you can no longer rely on length() How I'm longing for Java now. Java has a 101 different container classes as standard. And if that was not enough, you can now

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Dmitry Boyarintsev
On Sun, Dec 4, 2016 at 5:28 AM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: > If I use an array to hold a list of say Integers. Is there any serious > performance penalty for resizing (growing) the dynamic array as I add > items. My point being, I don't know the number of elements

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Graeme Geldenhuys
On 2016-12-04 11:30, Martin Schreiber wrote: > That happens with every reallocmem() with FPC memory manager so using a > getmem() block instead of a dynamic array has no advantage in this Maybe a good old linked list implementation is the best performer then. Back to the Pascal of the 80's and

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Martin Schreiber
On 12/04/2016 11:39 AM, Martin Schreiber wrote: > On 12/04/2016 11:28 AM, Graeme Geldenhuys wrote: >> Hi, >> >> If I use an array to hold a list of say Integers. Is there any serious >> performance penalty for resizing (growing) the dynamic array as I add >> items. My point being, I don't know the

Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Martin Schreiber
On 12/04/2016 11:28 AM, Graeme Geldenhuys wrote: > Hi, > > If I use an array to hold a list of say Integers. Is there any serious > performance penalty for resizing (growing) the dynamic array as I add > items. My point being, I don't know the number of elements I'll need > beforehand. > The

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Graeme Geldenhuys
On 2016-12-04 10:30, Yann Mérignac wrote: > You can try my GContnrs unit ( > http://yann.merignac.free.fr/unit-gcontnrs.html). It has tree sets that, as > i understand them, can fulfill your needs. Thank you for the offer. I'll definitely take a look at your code, but I don't think I can include

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Yann Mérignac
You can try my GContnrs unit ( http://yann.merignac.free.fr/unit-gcontnrs.html). It has tree sets that, as i understand them, can fulfill your needs. 2016-12-04 11:25 GMT+01:00 Graeme Geldenhuys : > Hi Florain, > > Thanks for the quick response. > > On 2016-12-04

[fpc-pascal] performance when resizing a dynamic array

2016-12-04 Thread Graeme Geldenhuys
Hi, If I use an array to hold a list of say Integers. Is there any serious performance penalty for resizing (growing) the dynamic array as I add items. My point being, I don't know the number of elements I'll need beforehand. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Graeme Geldenhuys
Hi Florain, Thanks for the quick response. On 2016-12-04 10:06, Florian Klämpfl wrote: > You mean you want allow duplicates? I want the list to silently ignore duplicates. eg: numberList.Duplicates := dupIgnore; numberList.Sorted := true; numberList.add(1); numberList.add(2);

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Martin Schreiber
On 12/04/2016 10:43 AM, Graeme Geldenhuys wrote: > The code I'm working on often needs a list of integers (actually uint16, > int16 etc, but Integer should do). I would normally use an array, but I > have no idea how many items I'll need beforehand. As an alternative to the FPC lists MSEgui

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Florian Klämpfl
Am 04.12.2016 um 10:46 schrieb Graeme Geldenhuys: > On 2016-12-04 09:43, Graeme Geldenhuys wrote: >> I would still like to hear of the RTL or FCL has other container I could >> use. > > I forgot to mention, I also need the following additional functionality > for such a container. Sorting and

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Graeme Geldenhuys
On 2016-12-04 09:43, Graeme Geldenhuys wrote: > I would still like to hear of the RTL or FCL has other container I could > use. I forgot to mention, I also need the following additional functionality for such a container. Sorting and Ignore Duplicates. Regards, Graeme

[fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Graeme Geldenhuys
Hi, The code I'm working on often needs a list of integers (actually uint16, int16 etc, but Integer should do). I would normally use an array, but I have no idea how many items I'll need beforehand. Obviously I could take 15 minutes and implement my own TIntList class or something, but that got