Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Michael Van Canneyt via fpc-pascal
On Wed, 24 May 2023, Hairy Pixels via fpc-pascal wrote: On May 21, 2023, at 11:03 PM, Michael Van Canneyt via fpc-pascal wrote: They're used all over the place in the RTL and FCL, so you better take them into account. The compiler will do this wrapping anyway if you use ansistrings,

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Hairy Pixels via fpc-pascal
> On May 21, 2023, at 11:03 PM, Michael Van Canneyt via fpc-pascal > wrote: > > They're used all over the place in the RTL and FCL, so you better take them > into account. > > The compiler will do this wrapping anyway if you use ansistrings, so the > approach with e.g. a generic record will

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Mi., 24. Mai 2023, 14:10: > You must have $H+ on and those are AnsiStrings? Why is there exception > handling involved with AnsiString? I guess it needs this just in case an > exception is thrown somewhere in the call stack? Because Ansi- and

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Marco van de Voort via fpc-pascal
On 23-5-2023 12:44, Benito van der Zander via fpc-pascal wrote: Hi, Depends on your code. I wrote all my code in Delphi 4. From 1998 or so. I do not make new projects, only maintain old ones. Delphi 4 felt much better. Like take: procedure test; var s: string; begin   s:= 'abc'; end;

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Benito van der Zander via fpc-pascal
Hi, It is weird that your code calls setjmp? Are you using a non Windows platform?  Comparisons with Delphi should be done on Windows where the exception systems match. Apples to Apples please. It is FPC on Linux. And Delphi 4 on Linux (in WINE) Even if it wants to do the Linux nonsense,

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Sven Barth via fpc-pascal
Benito van der Zander via fpc-pascal schrieb am Mi., 24. Mai 2023, 13:00: > Hi, > > It is weird that your code calls setjmp? Are you using a non Windows > platform? Comparisons with Delphi should be done on Windows where the > exception systems match. Apples to Apples please. > > > It is FPC on

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Hairy Pixels via fpc-pascal
You must have $H+ on and those are AnsiStrings? Why is there exception handling involved with AnsiString? I guess it needs this just in case an exception is thrown somewhere in the call stack? > On May 23, 2023, at 5:44 PM, Benito van der Zander via fpc-pascal > wrote: > > Like take: > >

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Marco van de Voort via fpc-pascal
On 24-5-2023 13:00, Benito van der Zander via fpc-pascal wrote: It is weird that your code calls setjmp? Are you using a non Windows platform?  Comparisons with Delphi should be done on Windows where the exception systems match. Apples to Apples please. It is FPC on Linux. And Delphi 4 on

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Hairy Pixels via fpc-pascal
> On May 24, 2023, at 8:46 PM, Michael Van Canneyt via fpc-pascal > wrote: > > I see no problem, I am used to this. > > This is Pascal, you need to manage your memory and hence your references, > this is true even in the absence of exceptions: In your example you would > also need to

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Do., 25. Mai 2023, 04:26: > > > > On May 24, 2023, at 10:11 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > You must have $H+ on and those are AnsiStrings? Why is there exception > handling involved with AnsiString? I guess

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Hairy Pixels via fpc-pascal
> On May 24, 2023, at 10:11 PM, Sven Barth via fpc-pascal > wrote: > > You must have $H+ on and those are AnsiStrings? Why is there exception > handling involved with AnsiString? I guess it needs this just in case an > exception is thrown somewhere in the call stack? > > Because Ansi- and

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Michael Van Canneyt via fpc-pascal
On Thu, 25 May 2023, Hairy Pixels via fpc-pascal wrote: On May 24, 2023, at 10:11 PM, Sven Barth via fpc-pascal wrote: You must have $H+ on and those are AnsiStrings? Why is there exception handling involved with AnsiString? I guess it needs this just in case an exception is thrown

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Sven Barth via fpc-pascal
Benito van der Zander via fpc-pascal schrieb am Do., 25. Mai 2023, 00:15: > Hi > > > Then also run FPC/win32 in wine for a real comparison. > > > Or perhaps against modern C++ on Linux would also be a real comparison > It wouldn't be, because that would compare two different languages. C++

Re: [fpc-pascal] Freeing memory with exceptions

2023-05-24 Thread Benito van der Zander via fpc-pascal
Hi Then also run FPC/win32 in wine for a real comparison. Or perhaps against modern C++ on Linux would also be a real comparison FPC could at least inline fpc_setjmp in fpc_pushexceptaddr to make it only one function call. These kinds of statements are counter-productive. That is a