Re: [fpc-pascal] Procedural generics question

2020-09-03 Thread Lars via fpc-pascal
On 2020-08-26 05:44, Nico Neumann via fpc-pascal wrote: The TypeInfo function checks the code during run-time thus the generated code is 'bloated'. Better use the compiler intrinsic GetTypeKind. {$mode objfpc} uses typinfo; generic procedure Add; begin if GetTypeKind(T) = tkInteger then

[fpc-pascal] Procedural generics question

2020-08-24 Thread Lars via fpc-pascal
Inside a generic procedure (no objects used just a procedure) is there a way to check which type the code is being used for such as: generic procedure Add(); begin if type = integer then... if type = string then... begin // specialized code for that type only end end; I remember so

Re: [fpc-pascal] How reliable are Hashlists in Contnrs

2020-08-24 Thread Lars via fpc-pascal
On 2020-08-24 14:01, nore...@z505.com wrote: I've noticed some problem with another hashlist that after adding about 2000 items to it, it starts to have problems. BTW, sorry to be more clear I meant I used another hashlist unit, not the contnrs one but another open source public domain one T

[fpc-pascal] Difference between Associative array and Hashlist?

2020-08-24 Thread Lars via fpc-pascal
Since FPC has no associative array I was thinking that the closest is TStringList with name/value pairs. Then there is a hashlist in contnrs. Maybe an associative array means you don't have to implement it using hashes in order for it to work? If there is a need for one I might write one as

[fpc-pascal] How reliable are Hashlists in Contnrs

2020-08-24 Thread Lars via fpc-pascal
I've noticed some problem with another hashlist that after adding about 2000 items to it, it starts to have problems. There are duplicates added (possibly a collision?) Is there a such thing as a perfect hashlist which never has a collision, or will they always have problems... In that case a