[fpc-pascal] Result: string
José Mejuto
joshyfun at gmail.com
Mon Mar 4 23:33:20 CET 2013
El 04/03/2013 22:16, Michael Van Canneyt escribió:
>> That report says the issue was assigned to Jonas and fixed in revision
>> 20427 (ver 2.6.1).
>> I find the current release (2.6.2) initialises a string function
>> result to EmptyStr as you would hope.
[...]
> Prints AA
Hello,
I'm asking because today I has updated my old 2.7.1 SVN since 8-9 months
and a library starts to fail and the "bug" was the Result string which
enters the function with a value while it does not happend in the old one.
If Result as string is not initialized a warning should be issued do not
? This happends in your simple test, but I was unable to find it in the
library that I'm using.
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.
-----------------------------------
In this situation no warning happends and result is different if I
uncomment the "Result:='';" line.
I think the missing warning is a bug, the missing warning or the non
initialization.
--
More information about the fpc-pascal
mailing list