Re: [fpc-pascal] Initialize records C style

2018-01-30 Thread Marco van de Voort
In our previous episode, Darius Blaszyk said: > I have this code in C, the variable p is a 20 element array. However > only the first two items are initialized. Is this possible in pascal as > well? No, all or nothing. ___ fpc-pascal maillist - fpc

[fpc-pascal] Initialize records C style

2018-01-30 Thread Darius Blaszyk
I have this code in C, the variable p is a 20 element array. However only the first two items are initialized. Is this possible in pascal as well? TIA, Darius struct point { intx; inty; }; struct point p[20]= { {0, 100}, {3,1} }; _

Re: [fpc-pascal] Initialize object variables

2011-04-28 Thread Sven Barth
Am 28.04.2011 11:33, schrieb Howard Page-Clark: On 28/4/11 10:00, Jürgen Hestermann wrote: Darius Blaszyk schrieb: Is there any way to initialize object variables, other than writing an init method? So something like: myobj = object myvar: word = $; end; I don't think so. An object is a

Re: [fpc-pascal] Initialize object variables

2011-04-28 Thread Howard Page-Clark
On 28/4/11 10:00, Jürgen Hestermann wrote: Darius Blaszyk schrieb: Is there any way to initialize object variables, other than writing an init method? So something like: myobj = object myvar: word = $; end; I don't think so. An object is a pointer to a data structure on the heap. At compi

Re: [fpc-pascal] Initialize object variables

2011-04-28 Thread Jürgen Hestermann
Darius Blaszyk schrieb: Is there any way to initialize object variables, other than writing an init method? So something like: myobj = object myvar: word = $; end; I don't think so. An object is a pointer to a data structure on the heap. At compile time, this data structure is not y

[fpc-pascal] Initialize object variables

2011-04-28 Thread Darius Blaszyk
Is there any way to initialize object variables, other than writing an init method? So something like: myobj = object myvar: word = $; end; Regards, Darius___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/m

Re: [fpc-pascal] Initialize/Finalize with count, is it possible?

2010-11-20 Thread Max Vlasov
On Sat, Nov 20, 2010 at 1:29 PM, Sven Barth wrote: > On 20.11.2010 10:07, Honza wrote: > >> 2010/11/20 Max Vlasov: >> >>> FillChar(Section^, Count*ElementSize, 0); >>> Initialize(TNameValueRec(Section^), Count); >>> >>> Is possible for such syntax to be supported? Probably I'm one

Re: [fpc-pascal] Initialize/Finalize with count, is it possible?

2010-11-20 Thread Michael Van Canneyt
On Sat, 20 Nov 2010, Sven Barth wrote: On 20.11.2010 10:07, Honza wrote: 2010/11/20 Max Vlasov: FillChar(Section^, Count*ElementSize, 0); Initialize(TNameValueRec(Section^), Count); Is possible for such syntax to be supported? Probably I'm one of those rare developer usin

Re: [fpc-pascal] Initialize/Finalize with count, is it possible?

2010-11-20 Thread Sven Barth
On 20.11.2010 10:07, Honza wrote: 2010/11/20 Max Vlasov: FillChar(Section^, Count*ElementSize, 0); Initialize(TNameValueRec(Section^), Count); Is possible for such syntax to be supported? Probably I'm one of those rare developer using it, and maybe because of this I just have

Re: [fpc-pascal] Initialize/Finalize with count, is it possible?

2010-11-20 Thread Max Vlasov
On Sat, Nov 20, 2010 at 12:07 PM, Honza wrote: > 2010/11/20 Max Vlasov : > > FillChar(Section^, Count*ElementSize, 0); > > Initialize(TNameValueRec(Section^), Count); > > > > Is possible for such syntax to be supported? Probably I'm one of those > rare > > developer using it, and

Re: [fpc-pascal] Initialize/Finalize with count, is it possible?

2010-11-20 Thread Honza
2010/11/20 Max Vlasov : >     FillChar(Section^, Count*ElementSize, 0); >     Initialize(TNameValueRec(Section^), Count); > > Is possible for such syntax to be supported? Probably I'm one of those rare > developer using it, and maybe because of this I just have to make some patch > by mysel

[fpc-pascal] Initialize/Finalize with count, is it possible?

2010-11-19 Thread Max Vlasov
Hi, I just noticed that fpc when compiling in lazarus didn't allow me to use Initialize/Finalize with the parameter showing the number of records to initialize. Interesting, but I have a huge number of delphi sources using this syntax, something like FillChar(Section^, Count*ElementSize,

Re: [fpc-pascal] Initialize the object (not class)

2010-07-18 Thread Zaher Dirkey
On Sun, Jul 18, 2010 at 10:20 PM, Jonas Maebe wrote: > > 2 - is there a method i can override it to init my properties without to > > call it manualy O.init; > > No. Can i ask to be an "Feature Request" in FPC? Thanks -- Zaher Dirkey ___ fpc-pascal

Re: [fpc-pascal] Initialize the object (not class)

2010-07-18 Thread Jonas Maebe
On 18 Jul 2010, at 21:01, Zaher Dirkey wrote: > MyObject = object > private > FProp1: integer; > public > Prop1: integer read FProp1 write FProp1 > procedure Proc1; > end; > > used like > var > O: MyObject; > begin > O.Proc1; > end; > > 1 - The problem, i have random value in the prop1(I a

[fpc-pascal] Initialize the object (not class)

2010-07-18 Thread Zaher Dirkey
I have used object to make more easy, not need to create or free it, MyObject = object private FProp1: integer; public Prop1: integer read FProp1 write FProp1 procedure Proc1; end; used like var O: MyObject; begin O.Proc1; end; 1 - The problem, i have random value in the prop1(I am not

Re: [fpc-pascal] Initialize

2006-06-21 Thread Marco van de Voort
> The mailing seems extremely quiet, is everyone very smart or is there > another reason for it ? I'm not even sure if I can post questions about > Pascal programming to this list. The lists changed server machines in the past week. Only today most services should be fully up and running again. _

Re: [fpc-pascal] Initialize

2006-06-21 Thread Ewald Horn
Hi Jonas, thanks for the answer! I had this horrible nightmare that I am writing icky code that was going to crash and burn on me some time. The mailing seems extremely quiet, is everyone very smart or is there another reason for it ? I'm not even sure if I can post questions about Pascal prog

Re: [fpc-pascal] Initialize

2006-06-21 Thread Jonas Maebe
On 21 jun 2006, at 20:38, Ewald Horn wrote: How do I initialize a variable of the type : textfile ? I keep getting the following hints from the compiler using FPC but I can't figure it out. Hint: Local variable "inFile" does not seem to be initialized It is because the text/file paramete

[fpc-pascal] Initialize

2006-06-21 Thread Ewald Horn
Hi, silly question but I can't find the answer anywhere... How do I initialize a variable of the type : textfile ? I keep getting the following hints from the compiler using FPC but I can't figure it out. Hint: Local variable "inFile" does not seem to be initialized It's been ages since I've