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

2016-12-05 Thread denisgolovan
05.12.2016, 16:38, "Sven Barth" :Again: I don't see why anyone thinks of generics as complex. Your mail did not answer that in any way. Hm. I tried :)I can put it another way.No language element exists on its own.And generics are complex because they lead to more accidental complexity for reasons g

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

2016-12-05 Thread Sven Barth
Am 05.12.2016 12:01 schrieb "denisgolovan" : > > > 05.12.2016, 13:35, "Sven Barth" : >> >> I really don't get why some people think of generics as complex -.- > > > Exactly for the cited reason. See below. > > > Using plain old arrays, requires reinventing the wheel because you end up > > writing d

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

2016-12-05 Thread Dennis Poon
Lars wrote: Do you know about this feature: var SomeRec: TSomeRecord = (); This is good for global variable. But I wonder whether it has effect in procedure's local variable since it requires the compiler to clear the record on the stack (which is at different location every time). Den

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

2016-12-05 Thread Dennis Poon
Sven Barth wrote: Am 05.12.2016 08:24 schrieb "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 :

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

2016-12-05 Thread Adriaan van Os
Martin Schreiber wrote: On 12/05/2016 10:52 AM, Jürgen Hestermann wrote: I love dynamic arrays and I never found that performance was an issue. Agreed. I find this big nonsene, but everybody his opinion. Take the time to study and profile the issue in detail or keep using dynamic arrays.

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

2016-12-05 Thread denisgolovan
 05.12.2016, 13:35, "Sven Barth" :I really don't get why some people think of generics as complex -.- Exactly for the cited reason. See below. > Using plain old arrays, requires reinventing the wheel because you end up> writing duplicate functions for each array type (array of string) instead> of a

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

2016-12-05 Thread Sven Barth
Am 05.12.2016 11:01 schrieb "Lars" : > With data structures like this it does seem people are reinventing it, > especially when people use a TStringList to store integers (I have done > this before, a shame indeed, bad programming practice)... Or complex > generics which just seems like over engine

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

2016-12-05 Thread Sven Barth
Am 05.12.2016 08:24 schrieb "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 : aRecordTy

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

2016-12-05 Thread Lars
This topic title brings back nostalgia as I needed an integer list before, and found some, either in the contributed units section of fpc, or in some old turbopascal units by a company.. TurboPower with Julian Bucknall, or something similar. As I looked through the code, I wondered if fpc and delp

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

2016-12-05 Thread Lars
Do you know about this feature: var SomeRec: TSomeRecord = (); This initializes the record without needing fillchar. I assume your "Default()" call initializes the record initially. You can eliminate the default() call by initializing the record as part of your declaration. Some criticize this

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

2016-12-05 Thread Martin Schreiber
On 12/05/2016 10:52 AM, Jürgen Hestermann wrote: > > I love dynamic arrays and I never found that performance was an issue. > Agreed. Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinf

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

2016-12-05 Thread Jürgen Hestermann
Am 2016-12-04 um 14:09 schrieb 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 bes