On 29 Nov 2011, at 15:30, Michael Müller wrote:


Am 28.11.2011 um 13:12 schrieb Jonas Maebe:

You do get a warning if you use an "out" parameter inside a routine without first writing to it.

But only if you try to access an array element. I would have expected to get such a warning also when using Length(), Low() or High() (which I did in my original example). But I assume this difference is coming from how an array is handled.

Probably, yes. The checks for uninitialized values in FPC is are quite ad hoc en very much based on "best effort" rather than on any kind of guarantees.

Even without using SetLength() I assume that just by declaring an array variable there is an internal structure that contains the array length field and the pointer to the element block. And there is no possibility to differ between an uninitialized (since initialized internally) and a SetLength(, 0) or array := nil. Is this correct?

No. The compiler does not take into internal initializations for "uninitialized" checks.


Jonas_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to