[fpc-devel] Dangerous optimization in CASE..OF
Ondrej Pokorny
lazarus at kluug.net
Fri Jul 14 20:46:33 CEST 2017
Btw, when compiling this program with default Lazarus Release build mode:
program Project1;
{$mode objfpc}{$H+}
type
TMyEnum = (zero);
function MyFunc(const aEnum: TMyEnum): string;
begin
case aEnum of
zero: Result := '0';
end;
end;
begin
WriteLn(MyFunc(zero));
end.
I get a warning:
Compile Project, Mode: Release, Target: project1.exe: Success, Warnings: 1
project1.lpr(9,1) Warning: function result variable of a managed type
does not seem to be initialized
17 lines compiled, 0.1 sec, 34672 bytes code, 1316 bytes data
Ondrej
More information about the fpc-devel
mailing list