[fpc-pascal] which "managed" result types require extra work?

David Emerson dle3ab at angelbase.com
Mon Jun 27 02:55:14 CEST 2016

Okay, making a new thread here, to ask one question:

Which types do we need to initialize to null/nil/zero/'' when they are a 
function result?

- dynamic arrays

- ansistring
- unicodestring
- string, with {$H+} (but not string[length])

- records containing any of them

- anything else???

I understand COM-style interfaces are also managed types, do they also 
need a manual initialization to nil if a function result?

And, I'll ask again because it never got answered:

Is there any compiler switch or option that we can use to do this 
automatically? (which won't be disabled with any optimization level)


As a note... practically, this is a huge pain; if I have a record type 
that I use extensively, and then I add an ansistring or dynamic array 
field to that record type, then I'm going to have to look all over my 
code for functions returning that result type, and fix the initialization.



More information about the fpc-pascal mailing list