Re: [fpc-pascal] Container class for key-value pairs

2017-09-11 Thread Michael Van Canneyt
On Mon, 11 Sep 2017, Marc Santhoff wrote: Hi, since I'm programming Pascal only on occasion I'd like to know: Which container class ist the easiest to use for key-value pairs? The goal is to store a configuration set from a hardware measuring device having 81 items. This item set is fixed,

Re: [fpc-pascal] Container class for key-value pairs

2017-09-11 Thread leledumbo via fpc-pascal
> Which container class ist the easiest to use for key-value pairs? All are just as easy. Instead you should state for non-functional requirements. Does it have to be fast? Does it have to be memory efficient? Or as long as you can access it as key-value then it would be fine no matter what the im

[fpc-pascal] Inclocked/declocked

2017-09-11 Thread Ryan Joseph
I was time profiling some code and saw these 2 functions taking up large amounts of time. They’re coming from dynamic arrays and SetLength I believe but I was curious what they are exactly because I don’t believe I’ve seen them before. Is this normal for resizing dynamic arrays or are they doin

Re: [fpc-pascal] Inclocked/declocked

2017-09-11 Thread Sven Barth via fpc-pascal
Am 11.09.2017 11:14 schrieb "Ryan Joseph" : > > I was time profiling some code and saw these 2 functions taking up large amounts of time. They’re coming from dynamic arrays and SetLength I believe but I was curious what they are exactly because I don’t believe I’ve seen them before. Is this normal

Re: [fpc-pascal] Inclocked/declocked

2017-09-11 Thread Ryan Joseph
> On Sep 11, 2017, at 4:20 PM, Sven Barth via fpc-pascal > wrote: > > They're used for the reference counter of the array (or string or interface). > The reference counter changes each time you assign an array or pass it to a > by-value parameter or if you change a value (cause the compiler/R

Re: [fpc-pascal] Inclocked/declocked

2017-09-11 Thread Sven Barth via fpc-pascal
On 11.09.2017 11:46, Ryan Joseph wrote: > >> On Sep 11, 2017, at 4:20 PM, Sven Barth via fpc-pascal >> wrote: >> >> They're used for the reference counter of the array (or string or >> interface). The reference counter changes each time you assign an array or >> pass it to a by-value parameter

Re: [fpc-pascal] Container class for key-value pairs

2017-09-11 Thread Marc Santhoff
On Mo, 2017-09-11 at 09:22 +0200, Michael Van Canneyt wrote: > > On Mon, 11 Sep 2017, Marc Santhoff wrote: > > > Hi, > > > > since I'm programming Pascal only on occasion I'd like to know: > > > > Which container class ist the easiest to use for key-value pairs? > > > > The goal is to store a con

Re: [fpc-pascal] Container class for key-value pairs

2017-09-11 Thread Marc Santhoff
On Mo, 2017-09-11 at 00:40 -0700, leledumbo via fpc-pascal wrote: > > Which container class ist the easiest to use for key-value pairs? > > All are just as easy. Instead you should state for non-functional > requirements. Does it have to be fast? Does it have to be memory efficient? > Or as long a

[fpc-pascal] Comparison operator for generics

2017-09-11 Thread Ryan Joseph
This is a common pattern I’m finding when working with generics in FPC. In the example below there is an equals comparison that needs to be checked but for some types such as records there is no default operator overload so I need to add one for every record that will be specialized in the class

Re: [fpc-pascal] Inclocked/declocked

2017-09-11 Thread Ryan Joseph
> On Sep 12, 2017, at 2:35 AM, Sven Barth via fpc-pascal > wrote: > > I've rechecked and the thing is as follows: > - the IncLocked call happens each time you assign a dynamic array to > another dynamic array variable or a by-value parameter (this also > includes being part of a record, but not

Re: [fpc-pascal] Inclocked/declocked

2017-09-11 Thread Sven Barth via fpc-pascal
Am 12.09.2017 06:54 schrieb "Ryan Joseph" : > > > > On Sep 12, 2017, at 2:35 AM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > > > I've rechecked and the thing is as follows: > > - the IncLocked call happens each time you assign a dynamic array to > > another dynamic array

Re: [fpc-pascal] Comparison operator for generics

2017-09-11 Thread Sven Barth via fpc-pascal
Am 12.09.2017 06:49 schrieb "Ryan Joseph" : > > This is a common pattern I’m finding when working with generics in FPC. In the example below there is an equals comparison that needs to be checked but for some types such as records there is no default operator overload so I need to add one for every