[fpc-devel] Wrong docs: not initialized global variables

Jonas Maebe jonas at freepascal.org
Sun Mar 25 16:28:22 CEST 2018


On 2018-03-25 00:09, Ondrej Pokorny wrote:
> I found the source of my assumption, I get a compiler warning in this
> case:
> 
> program StringsTest;
> function Test: string;
> var S: string;
> begin
>   S := S + 'a';
>   Result := S;
> end;
> begin
>   Writeln(Test);
> end.
> 
> Emits:
> StringsTest.lpr(5,8) Warning: Local variable "S" of a managed type
> does not seem to be initialized
> 
> Why do I get the compiler warning when the variable is indeed
> guaranteed to be initialized to nil/empty string?

https://bugs.freepascal.org/view.php?id=24601


Jonas



More information about the fpc-devel mailing list