On 04.07.2018 12:08, Yuriy Sydorov wrote:
Remove the warning or change it to a note in such case.
Earlier in this thread I tried to convince the FPC team to downgrade the
warning to a note. Without success. I was told that there is is no "good
reason to change the priority of the message".
Actually there is the same compiler message as a note as well already
now - the compiler decides if a warning or hint is shown on irrational
reasons. E.g.:
program Project1;
procedure TestSetLength;
var
S: string;
begin
SetLength(S, 0);
end;
procedure TestFillChar;
var
S: string;
begin
FillChar(S, 5, 0);
end;
begin
TestSetLength;
TestFillChar;
end.
Guess what line (SetLength or FillChar) is bad and guess what line has a
higher message level.
FPC has three (!) non-fatal message levels before error (hint, note,
warning) and yet they decided to use the highest rank in this case.
Probably because to use SetLength/... on an uninitialized managed local
variable it is the most unsafe yet compilable code ever typed into the
editor.
If I was FillChar I would sue the FPC team for discrimination in front
of the EU court that I want a warning as well, like SetLength. As
FillChar I would feel less important :P
Ondrej
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel