Re: [fpc-pascal] Initializing Records Automatically

2008-03-24 Thread Jonas Maebe
On 24 Mar 2008, at 12:03, ik wrote: Since when are you using fillchar on a string in Pascal ? that's a C approach. He's using it on a record. Initialising records with fillchar (regardless of what they contain) is quite common in Pascal as well. And as Florian mentioned, if you do this fo

Re: [fpc-pascal] Initializing Records Automatically

2008-03-24 Thread ik
Since when are you using fillchar on a string in Pascal ? that's a C approach. BTW Most Pascal's string functions will stop on the first #0 they encounter, at least the Delphi's tool that I remember. I think he misses the entire point in his blog. Ido On Mon, Mar 24, 2008 at 1:20 PM, L <[EMAIL

Re: [fpc-pascal] Initializing Records Automatically

2008-03-24 Thread Marco van de Voort
> L schrieb: > > > > Many times I find myself initializing stuff tediously and error prone > > when you do it a human way without automation. > > Records and objects containing automated fields are initialized? Are they? Or only the automated fields? __

Re: [fpc-pascal] Initializing Records Automatically

2008-03-24 Thread Florian Klaempfl
L schrieb: > http://stanleyxu2005.blogspot.com/2008/01/potential-memory-leak-by-initializing.html > > > Interesting.. > > So with > > procedure InitRecord(out R; SizeOfRecord: Integer); > begin > FillChar(R, SizeOfRecord, #0); > end; > > Even if it has dynamic array, ansistrings, shortstrings

[fpc-pascal] Initializing Records Automatically

2008-03-24 Thread L
http://stanleyxu2005.blogspot.com/2008/01/potential-memory-leak-by-initializing.html Interesting.. So with procedure InitRecord(out R; SizeOfRecord: Integer); begin FillChar(R, SizeOfRecord, #0); end; Even if it has dynamic array, ansistrings, shortstrings, integers, I assume it is okay to i