Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2022-05

Different levels of the same compiler message

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

gabor

Why am I getting a different level (hint/warning) of the same compiler message in similar code, only differing in return type?

The following example:

program Project1;
uses SysUtils;
function Test1: String;
begin
   SetLength(Result, 0);
end;
function Test2: TBytes;
begin
   SetLength(Result, 0);
end;
begin
   Test1;
   Test2;
end.

compiles with messages:

Free Pascal Compiler version 3.3.1-11052-g621f3b8387-dirty [2022/05/19] for i386
Copyright (c) 1993-2022 by Florian Klaempfl and others Target OS: Win32 for i386
Compiling project1.lpr
project1.lpr(7,19) Hint: Function result variable of a managed type does not seem to be initialized
project1.lpr(12,19) Warning: Function result variable of a managed type does not seem to be initialized

Regards, Michał.