<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Hairy Pixels via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Do., 25. Mai 2023, 04:26:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On May 24, 2023, at 10:11 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-pascal@lists.freepascal.org</a>> wrote:<br>
> <br>
> 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?<br>
> <br>
> 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. <br>
> <br>
<br>
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?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Disabling implicit exception frames does exactly what it says in the tin and removes these automatically generated frames. This however opens you to potential memory leaks if an exception occurs, so one should think twice whether one uses this option.</div><div dir="auto">Thankfully it's a local directive, so one can make this choice for every function. </div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>