Hi, What exactly is the difference (if any) between the parameter modifier when you pass a class instance to a procedure?
In the example below, I can define foo() as follows... procedure foo(AClass: TStringList); or procedure foo(var AClass: TStringList); or procedure foo(const AClass: TStringList); ...and the program output is always the same. As in the first case where I don't specify var or const, how does FPC treat the AClass parameter? -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- program a; {$mode objfpc}{$H+} uses Classes; procedure foo(AClass: TStringList); begin AClass.Add('inside foo'); end; var sl: TStringList; begin sl := TStringList.Create; try sl.Add('inside main'); foo(sl); sl.Add('the end'); writeln(sl.Text); finally sl.free; end; end. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Here is the program output: $ ./a inside main inside foo the end -- Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal