[fpc-pascal] Difference between string and Tbytes as procedure arguments?

2023-11-05 Thread Bo Berglund via fpc-pascal
I am maintaining an old utility program that started out about 20+ years ago using Delphi7. The utility communicates via RS232 with a measuring system in order to retrieve and process recorded data and at the time this was started I used strings as buffers for the serial comm. A string at the

Re: [fpc-pascal] Creating capturers

2023-11-05 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Sa., 4. Nov. 2023, 15:48: > > > > On Nov 4, 2023, at 4:22 PM, Sven Barth > wrote: > > > > Then don't assign them every "frame". If you just keep them around then > they aren't more expensive than a virtual method call. > > And any other mechanism would involve the heap

Re: [fpc-pascal] Difference between string and Tbytes as procedure arguments?

2023-11-05 Thread Bo Berglund via fpc-pascal
On Sun, 5 Nov 2023 10:36:47 +0100 (CET), Michael Van Canneyt via fpc-pascal wrote: >> So my question is this: >> Is there a difference in handling the arguments between string, AnsiString, >> RawByteString and TBytes in a declaration like this: >> >> function TSSConnection.ParseCmdFileData(var

Re: [fpc-pascal] Difference between string and Tbytes as procedure arguments?

2023-11-05 Thread Michael Van Canneyt via fpc-pascal
On Sun, 5 Nov 2023, Bo Berglund via fpc-pascal wrote: You must copy the data. The copy() function can be used for this. Follow-up question: Can I change the function declaration like this and preserve the content? function TSSConnection.ParseCmdFileData(var SSCmdFile: TSSCommandFile;

Re: [fpc-pascal] Difference between string and Tbytes as procedure arguments?

2023-11-05 Thread Michael Van Canneyt via fpc-pascal
On Sun, 5 Nov 2023, Bo Berglund via fpc-pascal wrote: I am maintaining an old utility program that started out about 20+ years ago using Delphi7. The utility communicates via RS232 with a measuring system in order to retrieve and process recorded data and at the time this was started I used

Re: [fpc-pascal] Compiler probem?

2023-11-05 Thread Sven Barth via fpc-pascal
Paul Renaud via fpc-pascal schrieb am Sa., 4. Nov. 2023, 16:18: > Hi, I have a question about some code. > > The following code segment generated a compiler error when I compiled it > with... > > fpc Sample -Se -gl -al > > but not when it's compiled with... > > fpc Sample -Se -gl > > ... > Asm >

Re: [fpc-pascal] Compiler probem?

2023-11-05 Thread Adriaan van Os via fpc-pascal
Paul Renaud via fpc-pascal wrote: Hi, I have a question about some code. The following code segment generated a compiler error when I compiled it with... "A compiler error" assumes that we all have a crystal ball to look in Regards, Adriaan van Os