[fpc-pascal] Result: string

Howard Page-Clark hdpc at talktalk.net
Tue Mar 5 11:23:46 CET 2013


On 04/03/13 10:33, José Mejuto wrote:

> The code that makes me wonder something is wrong is this one:
>
> -----------------------------------
> {$mode objfpc}
> {$h+}
>
> procedure TheB(var aTheA: string);
>
> begin
>    aTheA:=aTheA+'A';
> end;
>
> function TheA(): string;
>
> begin
>    //Result:='';
>    TheB(Result);
> end;
>
> Var
>    C : String;
>
> begin
>    C:='B';
>    C:=TheA;
>    C:=TheA;
>    Writeln('= "',C,'"');
> end.

For me (win32, FPC 2.6.2) the output is identical (= "A") whether or not 
Result in TheA() is initialised manually or not. Perhaps 2.7.1 has a 
regression here if it differs for you?

Howard




More information about the fpc-pascal mailing list