[fpc-pascal] Result: string

Sven Barth pascaldragon at googlemail.com
Tue Mar 5 11:40:10 CET 2013


Am 05.03.2013 11:27, schrieb Michael Van Canneyt:
>
>
> On Tue, 5 Mar 2013, Howard Page-Clark wrote:
>
>> 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?
>
> It is not a regression. 2.7.1 has the Delphi compatible behaviour.

Seems that we should add a remark here: 
http://wiki.lazarus.freepascal.org/User_Changes_Trunk

Regards,
Sven



More information about the fpc-pascal mailing list