[fpc-pascal] SetLength warnings - request

Martok listbox at martoks-place.de
Mon Dec 31 02:54:57 CET 2018


> There is a hint for such parameters even though the compiler knows they 
> always contain a valid value, because valid in the sense of "won't crash 
> the program" is not the same as "this is what the programmer intended".

Are you baiting me, or was that accidental? ;-)


> 1) Dynamic arrays are initialised with nil, but that is an 
> implementation detail

Is it, though? Global variables and instance fields are zero-filled, local
variables as if the local variable block was a record passed to Initialize()
(so, recursively zeroing managed fields). Although it is never spelled out, the
Delphi manual heavily implies this.
I would guess most if not all pascal programmers wrote code that relies on that
at some point.

@MvC: I'll come up with some examples and add it to the Portability page, since
the different result variable initialization rules already are a bit of an issue.

-- 
Regards,
Martok




More information about the fpc-pascal mailing list