Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Rainer Stratmann
Am Friday 20 November 2009 07:40:33 schrieb Graeme Geldenhuys: > Rainer Stratmann wrote: > > May be it is possible to make a compiler switch like > > $PASS_VAR_NO_HINT ON > > No. My issue is not the hint in general. The hint is if for "real" > issues. My issue is that I tried to solve the compiler

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Graeme Geldenhuys
Flávio Etrusco wrote: > > Out of curiosity, does anybody know how Delphi solves this? I don't > remember seeing a warning (having to initialize variables) on FillChar > in Delphi... I tried the same thing last night with Kylix 3. It seems Kylix (and probably Delphi) doesn't even have such a hint

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Graeme Geldenhuys
Rainer Stratmann wrote: > May be it is possible to make a compiler switch like > $PASS_VAR_NO_HINT ON No. My issue is not the hint in general. The hint is if for "real" issues. My issue is that I tried to solve the compiler hint by manually initializing my structured types using FillChar(). And it

Re: [fpc-pascal] How to solve "Conversion between ordinals and pointers is not portable"

2009-11-19 Thread Paul Nicholls
- Original Message - From: "Tomas Hajny" To: ; "FPC-Pascal users discussions" Sent: Wednesday, November 18, 2009 10:40 PM Subject: Re: [fpc-pascal] How to solve "Conversion between ordinals and pointers is not portable" On Tue, November 17, 2009 10:48, Graeme Geldenhuys wrote:

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Brad Campbell
Holger Bruns wrote: At first, there must be a queue for incoming data despite I ruled out a queue with an inbuffer with the length 1. No, you did not rule out a queue at all, you are simply reading from it 1 byte at a time. I'm absolutely positive you can do what you want to do by simply us

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Flávio Etrusco
On Thu, Nov 19, 2009 at 4:18 AM, Jonas Maebe wrote: > > On 19 Nov 2009, at 07:35, Graeme Geldenhuys wrote: > >> Somebody did once attempt to correct the var parameter to out parameter >> in FillChar, but got to many errors. Probably not a high priority issue, >> so the problem was simply swept und

Re: suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

2009-11-19 Thread Martin
Vinzent Höfler wrote: Rainer Stratmann : Am Thursday 19 November 2009 23:16:26 schrieb Vinzent Höfler: {$HINTS OFF} ... code ... {$HINTS DEFAULT} maybe? Whereas DEFAULT restores the switch to the original state. But then you have to do it everywhere in the code instead of on

Re: suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

2009-11-19 Thread Vinzent Höfler
Rainer Stratmann : > Am Thursday 19 November 2009 23:16:26 schrieb Vinzent Höfler: > > > > {$HINTS OFF} > > > > ... code ... > > > > {$HINTS DEFAULT} > > > > maybe? Whereas DEFAULT restores the switch to the original state. > > But then you have to do it everywhere in the code instead of one time

Re: suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

2009-11-19 Thread Martin
Rainer Stratmann wrote: Am Thursday 19 November 2009 23:16:26 schrieb Vinzent Höfler: Martin : Ideally it would be, if there was a directive or similar, to suppress it for given lines (or statements). one that is easier than {$push} { $HINT OFF} ... {$POP} {$HINTS OFF} ... code

Re: suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

2009-11-19 Thread Rainer Stratmann
Am Thursday 19 November 2009 23:16:26 schrieb Vinzent Höfler: > Martin : > > Ideally it would be, if there was a directive or similar, to suppress it > > for given lines (or statements). > > one that is easier than {$push} { $HINT OFF} ... {$POP} > > {$HINTS OFF} > > ... code ... > > {$HINTS DEFAUL

Re: suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

2009-11-19 Thread Vinzent Höfler
Martin : > Ideally it would be, if there was a directive or similar, to suppress it > for given lines (or statements). > one that is easier than {$push} { $HINT OFF} ... {$POP} {$HINTS OFF} ... code ... {$HINTS DEFAULT} maybe? Whereas DEFAULT restores the switch to the original state. Vinze

suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

2009-11-19 Thread Martin
Jonas Maebe wrote: On 19 Nov 2009, at 22:50, Rainer Stratmann wrote: Yes, but for that is the compiler-switch $PASS_VAR_NO_HINT ON. Then no hint is put out by the compiler. When using FPC 2.4.0rc1 or later: a) compile your code with -vq b) note the message number for the warning/note/h

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Jonas Maebe
On 19 Nov 2009, at 22:50, Rainer Stratmann wrote: > Yes, but for that is the compiler-switch $PASS_VAR_NO_HINT ON. > Then no hint is put out by the compiler. When using FPC 2.4.0rc1 or later: a) compile your code with -vq b) note the message number for the warning/note/hint you want to suppress

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Rainer Stratmann
Am Thursday 19 November 2009 22:40:53 schrieb Vinzent Höfler: > Rainer Stratmann : > > For me a variable is initialised when it passes a procedure/function > > which has a var declaration in the parameters. > > -- 8< -- > procedure Add_2 (var I : Integer); > begin >I := I + 2; > end; > -- 8< -

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Vinzent Höfler
Rainer Stratmann : > For me a variable is initialised when it passes a procedure/function > which has a var declaration in the parameters. -- 8< -- procedure Add_2 (var I : Integer); begin I := I + 2; end; -- 8< -- If the variable for the parameter I wasn't correctly initialized before, it

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Vinzent Höfler
Graeme Geldenhuys : > On 19/11/2009, Jonas Maebe wrote: > > > > > Or is it just a side effect? > > > > Yes. > > Well it seems the "side effect" is more popular use-case in FPC and > Delphi developers projects than the original intention of "out" then. Of course. The side-effect is much more in

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Vinzent Höfler
Graeme Geldenhuys : > 2009/11/19 "Vinzent Höfler" : > > > > Why don't you create your own initialization routine together with the > > Because not all the code I maintain is my own. Some code, as in the > case of DCPCrypt gave stacks of hints which were all false positives. I understand. > If I

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Vinzent Höfler
Florian Klaempfl : > Vinzent Höfler schrieb: > > Florian Klaempfl : > > > >> Out is not made to solve such problems but plainly to work with > >> COM/Corba. > > > > Really? Well, that's not what the FPC manual says: > > And? Is there a different reason written? And even if it is: > documentatio

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Vinzent Höfler
mar...@stack.nl: [Synapse/Synaser] > How do you use it? I'm used to TComport, and it seems that synaser, like > unit serial, only supports blocking use. call Connect, call Config, call the appropriate reading and writing subroutines (like SendString and RecvPacket)... > Do you put it in a threa

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Rainer Stratmann
For me a variable is initialised when it passes a procedure/function which has a var declaration in the parameters. May be it is possible to make a compiler switch like $PASS_VAR_NO_HINT ON instead of globally $HINTS OFF Then all variables wich passes for example the fillchar procedure are init

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Vinzent Höfler
Holger Bruns : > > Despite queues an baud rates, you must expect data loss. You will > > loss data in the physical layer. You have to implement some handshake > > to prevent it. (using google translator, excuse my english). > > Which can be done through a direct port access and some lines of cod

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Graeme Geldenhuys
On 19/11/2009, Jonas Maebe wrote: > > > Or is it just a side effect? > > Yes. Well it seems the "side effect" is more popular use-case in FPC and Delphi developers projects than the original intention of "out" then. BTW: I searched the Kylix and Delphi source folders. The "side effect" is used

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Graeme Geldenhuys
2009/11/19 "Vinzent Höfler" : >> Then create a different FillChar -type >> procedure to handle those corner cases, or create a different procedure >> which allows structure types to be initialized without compiler hints. > > Why don't you create your own initialization routine together with the Be

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Jonas Maebe
On 19 Nov 2009, at 20:44, cobines wrote: > Is it wrong to use "out" for the sole purpose of informing the compiler that > a function will set the initial value of a variable passed as the parameter? No. > Or is it just a side effect? Yes. > I use it all over the place in my programs. Is it s

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread cobines
W dniu 2009-11-19 20:29, Florian Klaempfl pisze: Vinzent Höfler schrieb: Florian Klaempfl: Out is not made to solve such problems but plainly to work with COM/Corba. Really? Well, that's not what the FPC manual says: And? Is there a different reason written? And even if it is: documentatio

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Florian Klaempfl
Vinzent Höfler schrieb: > Florian Klaempfl : > >> Out is not made to solve such problems but plainly to work with >> COM/Corba. > > Really? Well, that's not what the FPC manual says: And? Is there a different reason written? And even if it is: documentation writer know less than implementors :)

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Vinzent Höfler
Florian Klaempfl : > Out is not made to solve such problems but plainly to work with > COM/Corba. Really? Well, that's not what the FPC manual says: -- 8< -- The purpose of an out parameter is to pass values back to the calling routine: The variable is passed by reference. The initial value of

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Vinzent Höfler
Graeme Geldenhuys : [FillChar] > As for the COM usage requirement (which I honestly believe is the > minority use case in FPC). AFAIK, the different semantic of "out" parameters applies to all reference counted types. That's especially unfortunate with dynamic arrays, where you lose transparenc

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Paul Breneman
Marco van de Voort wrote: In our previous episode, Gustavo Enrique Jimenez said: Did you try Synaser? http://www.ararat.cz/synapse/doku.php/download . I use it on all my projects since 2006 without problems (linux, windows, etc...). How do you use it? I'm used to TComport, and it seems that sy

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Henry Vermaak
2009/11/19 Holger Bruns : > Gustavo Enrique Jimenez schrieb: >> >> Despite queues an baud rates, you must expect data loss.  You will >> loss data in the physical layer. You have to implement some handshake >> to prevent it. (using google translator, excuse my english). >> >> >> Gustavo >> >> > > W

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Gustavo Enrique Jimenez
2009/11/19 Marco van de Voort : > In our previous episode, Gustavo Enrique Jimenez said: >> Did you try Synaser? http://www.ararat.cz/synapse/doku.php/download . >> I use it on all my projects since 2006 without problems (linux, >> windows, etc...). > > How do you use it? I'm used to TComport, and

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Marco van de Voort
In our previous episode, Gustavo Enrique Jimenez said: > Did you try Synaser? http://www.ararat.cz/synapse/doku.php/download . > I use it on all my projects since 2006 without problems (linux, > windows, etc...). How do you use it? I'm used to TComport, and it seems that synaser, like unit serial,

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Gustavo Enrique Jimenez
2009/11/19 Holger Bruns : > Gustavo Enrique Jimenez schrieb: >>> >>> Thank you for your answer. I played with different baud rates. The sender >>> delivers a stream of bytes. The faster a transmission rate is, the less >>> amount of data can be received. This leds me to two conclusions: At >>> firs

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Marco van de Voort
In our previous episode, Holger Bruns said: > > > > Which can be done through a direct port access and some lines of code in > assembler language. The second idea I have is the use of the device > files /dev/ttySx, but how can these files be used to get access to all > of the registers of an

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Holger Bruns
Gustavo Enrique Jimenez schrieb: Thank you for your answer. I played with different baud rates. The sender delivers a stream of bytes. The faster a transmission rate is, the less amount of data can be received. This leds me to two conclusions: At first, there must be a queue for incoming data des

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Gustavo Enrique Jimenez
> > Thank you for your answer. I played with different baud rates. The sender > delivers a stream of bytes. The faster a transmission rate is, the less > amount of data can be received. This leds me to two conclusions: At first, > there must be a queue for incoming data despite I ruled out a queue

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Jonas Maebe
On 19 Nov 2009, at 14:30, Holger Bruns wrote: Since iopl is still not available to fpc in its 64-bit-version, I should move to c for future port programming. $ man iopl ... This call is mostly for the i386 architecture. On many other architec- tures it does not exist or will

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Holger Bruns
Brad Campbell schrieb: Holger Bruns wrote: Hi, one more question regarding the unit serial. I use the following function to get one single byte form a serial port, which has been open before with seropen: function getdata(inhandle: tserialhandle; var recdata: char): longint; begin fillchar(

Re: [fpc-pascal] Microsoft SAPI

2009-11-19 Thread ik
If my client will be willing to pay for it, or I'll find some time (and a Windows machine, I'm using my Client's Windows, while I'm using Linux myself), I'll be glad to do it :) Ido http://ik.homelinux.org/ On Thu, Nov 19, 2009 at 1:55 PM, Marco van de Voort wrote: > In our previous episode, i

Re: [fpc-pascal] Microsoft SAPI

2009-11-19 Thread Marco van de Voort
In our previous episode, ik said: > > Does anyone know of Pascal binding for Microsoft SAPI that can be used with > FPC ? maybe convert http://www.blong.com/Conferences/DCon2002/Speech/Speech.htm ? ___ fpc-pascal maillist - fpc-pascal@lists.freepasca

Re: [fpc-pascal] using popen() and assign/reset

2009-11-19 Thread Marco van de Voort
In our previous episode, Marc Santhoff said: > > I'm trying to get unix.popen() running. The RTL.pdf says the file opened > with popen (stdin for reading here) has to be reset or rewritten. The > example does not do anything like that. Apparantly that is false; uses unix; var f: text; s: an

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Graeme Geldenhuys
Zaher Dirkey wrote: > > procedure ZeroMemory(Destination: Pointer; Length: DWORD); > begin > FillChar(Destination^, Length, 0); > end; Out of interest, I would recommend you change DWORD to PtrUInt. DWORD is limited two a 32bit value on 64bit systems. Regards, - Graeme - -- fpGUI Toolkit

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Marco van de Voort
In our previous episode, Florian Klaempfl said: > > have the time to seek through all my 200,000+ lines of code looking for > > what is 'real' hints and what is 'fake' hints. > > > > I don't see any problem in trying to write code with no hints & > > warnings. That's simply clean code! > > If hin

[fpc-pascal] Microsoft SAPI

2009-11-19 Thread ik
Hello, Does anyone know of Pascal binding for Microsoft SAPI that can be used with FPC ? Thanks, Ido http://ik.homelinux.org/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] using popen() and assign/reset

2009-11-19 Thread Marc Santhoff
Hello, I'm trying to get unix.popen() running. The RTL.pdf says the file opened with popen (stdin for reading here) has to be reset or rewritten. The example does not do anything like that. The other part is the question whether the file has to be assign()'ed befor or not. var f: text; s: a

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > Jonas Maebe wrote: >> It's not about it not being a high priority problem, it's about it >> being fundamentally unfixable (except by using a completely different > > See my reply in fpc-devel mailing list. > > Bottom line is, I don't think it's right for a project th

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > Florian Klaempfl wrote: >> If hints are really important, they would be warnings. > > And working with a uninitialized data structure is a good thing? I think > not. So, like everybody else, I manually initialise my data structures - > and because of my efforts to writ

Re[2]: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread JoshyFun
Hello Graeme, Thursday, November 19, 2009, 8:52:41 AM, you wrote: GG> And working with a uninitialized data structure is a good thing? I think GG> not. So, like everybody else, I manually initialise my data structures - GG> and because of my efforts to write safer code, the compiler gives me a GG

Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Brad Campbell
Holger Bruns wrote: Hi, one more question regarding the unit serial. I use the following function to get one single byte form a serial port, which has been open before with seropen: function getdata(inhandle: tserialhandle; var recdata: char): longint; begin fillchar(inbuffer, sizeof(inbuffe