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

Jonas Maebe jonas at freepascal.org
Wed Apr 4 21:51:10 CEST 2018

On 04/04/18 20:26, Ondrej Pokorny wrote:
> The compiler initializes the variable implicitely for myself - this is 
> documented and I know it. There cannot be "wrong code behaviour" (as you 
> stated) and thus I cannot have an error. This is simple logic.

"Wrong behaviour" is not the same as "undefined behaviour" or "crash". 
It merely means "something different than the programmer intended". It 
is of course possible that you wanted the behaviour that you get when 
the variable contains the empty string, nil or 0, but because this 
initialisation is implicit rather than explicit, the compiler does not 
rely on this. After all, it is equally possible that you forgot to 
assign the correct (non-nil/0/empty string) value to the variable before 
using it the first time (in which case it would be an error in the program).

> I must not. Turning off warnings is forbidden. Turning off hints and notes is OK. That is the rules. 

The inflexibility of that rule in the Lazarus project is not a good 
reason to change the priority of the message.

> But I am not fine with the fact that the level of this message is a WARNING - the same level that real code errors are reported. 

Warnings are not errors. Warnings indicate possible errors, but they can 
also be false positives.


More information about the fpc-devel mailing list