[fpc-pascal] When the variable freed in Optimize compile

Martin fpc at mfriebe.de
Wed Jun 8 12:43:04 CEST 2011


On 08/06/2011 11:37, Zaher Dirkey wrote:
> On Wed, Jun 8, 2011 at 11:22 AM, <michael.vancanneyt at wisa.be 
> <mailto:michael.vancanneyt at wisa.be>> wrote:
>
>
>
>     On Wed, 8 Jun 2011, Zaher Dirkey wrote:
>
>         Hi, I know when compile the project with optimize in Delphi
>         the variable
>         freed/allocated after the last line used.
>         How can i make same in FPC, O3 not worked for me.
>         I used FPC 2.4.4
>
>         var
>          c: Currency;
>         begin
>          c := 10;
>          writeln(c);
>         <<now c freed
>          some code here
>         end;
>
>
>     C (as a currency) is never 'freed'. It is declared throughout the
>     whole procedure.
>
>
> What if C is string or Interface of TInterfacedObject?


Read the following threads, it has been lengthly discussed before:

http://lists.freepascal.org/lists/fpc-devel/2010-November/022806.html
http://lists.freepascal.org/lists/fpc-devel/2010-November/022867.html

there may be more threads by the same subject

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110608/dbc66815/attachment.html>


More information about the fpc-pascal mailing list