Re: [fpc-pascal] Freeing memory with exceptions

2023-05-25 Thread Steve Litt via fpc-pascal
Benito van der Zander via fpc-pascal said on Wed, 24 May 2023 13:00:04
+0200

>I regret installing Linux. Everything worked better with Windows 98
>and Delphi 4

Why not just take your Win98 install disk, install win98, then take
your Delphi 4 install disk, install Delphi 4, and you're all set. And
you can recover the 39 bytes you lost to Linux.

SteveT

Steve Litt 
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Freeing memory with exceptions

2023-05-25 Thread Michael Van Canneyt via fpc-pascal




On Thu, 25 May 2023, Benito van der Zander via fpc-pascal wrote:


Hi,



That 99.99% of people does use it, indicates they simply take the overhead 
because
of the advantages that the managed types offer. 


Or they simply do not know about the overhead


If people don't know there is overhead, that means it is negligible or
unimportant.

So either way, all is well.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Freeing memory with exceptions

2023-05-25 Thread Benito van der Zander via fpc-pascal

Hi,



That 99.99% of people does use it, indicates they simply take the 
overhead because
of the advantages that the managed types offer. 


Or they simply do not know about the overhead

Like I was writing all my code on Windows 98, and never noticed any 
overhead, until I started running benchmarks onĀ  Linux.


Bye,
Benito
On 25.05.23 07:58, Michael Van Canneyt via fpc-pascal wrote:



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 somewhere in the call stack?


Because Ansi- and UnicodeString are managed types. *All* managed 
types managed string types, interfaces, Variants, managed records) 
must be finalized correctly even if an exception occurs.




That's a problem with exceptions then, they are baked into the language
and impose a cost on all managed types now even if we use them or 
not. Even disabling the implicit stack frames (forgot what it's 
called) doesn't

get around this right?


Why do you insist it is a problem ?

Simply don't use managed types and don't use exceptions if you don't 
like the
overhead they cause. It's still perfectly possible: avoid the sysutils 
unit

and you're all set. The system unit does not use exceptions.

That 99.99% of people does use it, indicates they simply take the 
overhead because

of the advantages that the managed types offer.

Which is not to say that FPC should not strive to minimize the overhead.
Conceivably there is some gain possible on non-windows platforms.

Michael.
___
fpc-pascal maillistĀ  - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Freeing memory with exceptions

2023-05-25 Thread Sven Barth via fpc-pascal
Mattias Gaertner via fpc-pascal  schrieb
am Do., 25. Mai 2023, 08:23:

> On Thu, 25 May 2023 07:55:39 +0200
> Sven Barth via fpc-pascal  wrote:
>
> >[...]
> > But this is what "managed type" *means*: that the compiler and RTL
> > will make sure that it's correctly freed as long as nothing
> > unexpected happens.
>
> ... and exceptions are expected.
>

Depends on the circumstances: in code with disabled implicit exception
frames, but managed types exceptions are to be considered unexpected. But
otherwise they are indeed expected.


> Maybe better: As long as the user does not break the rules.
>

Agreed.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal