On 02/01/19 17:05, Benito van der Zander wrote:

1) Dynamic arrays are initialised with nil, but that is an implementation detail (required by the fact that they are reference counted: if they would contain random data, that would cause crashes)

If there ever is a fpc version that does not initialize them with nil, then it could show a warning. Till then it is pointless.

The compiler cannot distinguish between the following cases:
* the programmer knows the compiler initialises it with empty/nil, and in this particular case that happens to be the exact value that is wanted
* the programmer forgot to initialise the variable with an initial value

They are separate hints/warnings so that they can be disabled separately by programmers who know they will always want an empty string/array as initial value in case of managed types.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to