[fpc-pascal] Syntax changes suggestions
Ryan Joseph
ryan at thealchemistguild.com
Thu Jul 19 00:12:41 CEST 2018
> On Jul 18, 2018, at 4:01 PM, Ben Grasset <operator97 at gmail.com> wrote:
>
> Well, the array TFPGList uses for storage would still be allocated on the heap in any case no matter what…
That’s true but the other part remains true.
Here’s from the FPC compiler itself. sc is declared at the top and ~400 lines later it’s freed. If they knew they were going to free at the end of the function anyways why did they have to go all the way to bottom to do it? if you want to make sure it’s freed you need to scroll through the entire 400 lines to confirm this.
Personally for my taste I would like to just add a little keyword to the end of the variable so I don’t have to worry about it later.
var
sc : TFPObjectList;
begin
old_block_type:=block_type;
block_type:=bt_var;
recst:=tabstractrecordsymtable(symtablestack.top);
{$if defined(powerpc) or defined(powerpc64)}
is_first_type:=true;
{$endif powerpc or powerpc64}
{ Force an expected ID error message }
if not (token in [_ID,_CASE,_END]) then
consume(_ID);
{ read vars }
sc:=TFPObjectList.create(false);
**************** 400 lines later…. ****************
{ free the list }
sc.free;
{$ifdef powerpc}
is_first_type := false;
{$endif powerpc}
block_type:=old_block_type;
end;
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list