Re: [fpc-pascal] Array initialization

2009-03-18 Thread Jürgen Hestermann
A "fillword" procedure does not exist. It seems I was wrong about this. A "fillword" procedure DOES exist. I just discovered this myself. But then the range (size of variable) you want to fill has to be an even number of bytes. In general this may not be guaranteed. Jürgen Hestermann. _

Re: [fpc-pascal] Array initialization

2009-03-18 Thread Marco van de Voort
In our previous episode, J?rgen Hestermann said: > >> FillChar(Values,SizeOf(Values),0) > > That worked. > > However, for an integer is fillword better? > > A "fillword" procedure does not exist. http://www.freepascal.org/docs-html/rtl/system/fillbyte.html http://www.freepascal.org/docs-html/rtl/

Re: [fpc-pascal] Array initialization

2009-03-18 Thread Jürgen Hestermann
FillChar(Values,SizeOf(Values),0) That worked. However, for an integer is fillword better? A "fillword" procedure does not exist. FillChar is an anchient Pascal function to simply fill any arbitrary memory location of any size (determined by a variable) with all the same byte. It is very f

Re: [fpc-pascal] Array initialization

2009-03-18 Thread Francisco Reyes
Fantomas writes: As far as I know, global variables are initialised with zeros when an application starts. Gives a warning when I don't initialize it. split.pas(31,55) Warning: Variable "Values" does not seem to be initialized FillChar(Values,SizeOf(Values),0) That worked. However, for

Re: [fpc-pascal] Array initialization

2009-03-17 Thread Marc Santhoff
Am Dienstag, den 17.03.2009, 19:50 -0400 schrieb Francisco Reyes: > On the following URL, > http://web.mit.edu/sunsoft_v5.1/www/pascal/lang_ref/ref_data.doc.html#1212, > I found some different syntax to initialize an array. > > Examples there.. > var > c1 : array[1..10] of char := '123456'; > i

Re: [fpc-pascal] Array initialization

2009-03-17 Thread leledumbo
> On the following URL, > http://web.mit.edu/sunsoft_v5.1/www/pascal/lang_ref/ref_data.doc.html#1212, > I found some different syntax to initialize an array. That's another Pascal extension from Sun. One of the problem (and power) of Pascal is that it's often extended arbitrarily, because no sta

Re: [fpc-pascal] Array initialization

2009-03-17 Thread Andrew Brunner
var c1 : array[1..10] of char; begin fillchar(c1[1],5,0); fillchar(c1[5],5,#32); You might need @ sign in front of c1 though... ...or... const c1:array[1..10] of char = '123456789a'; On Tue, Mar 17, 2009 at 5:50 PM, Francisco Reyes wrote: > On the following URL, > http://web.mit.edu/

Re: [fpc-pascal] Array initialization

2009-03-17 Thread Fantomas
Hello, Francisco! Wednesday, March 18, 2009, 2:50:21 AM, you wrote: > Is a loop the only way to initialize all the values in an array other than > Values: array[1..2] of integer = (0,0); > In the program I am working on, Values will be an array of 128 integers and > I would like to initialize t

[fpc-pascal] Array initialization

2009-03-17 Thread Francisco Reyes
On the following URL, http://web.mit.edu/sunsoft_v5.1/www/pascal/lang_ref/ref_data.doc.html#1212, I found some different syntax to initialize an array. Examples there.. var c1 : array[1..10] of char := '123456'; int2 : array[1..100] of integer := [50 of 1, 50 of 2]; Tried those, but didn't se