[fpc-pascal] reference-counted function results not initialized to nil

Sven Barth pascaldragon at googlemail.com
Sun Jun 26 23:25:58 CEST 2016


On 26.06.2016 18:20, Jürgen Hestermann wrote:
> Am 2016-06-26 um 14:13 schrieb Sven Barth:
>> But also no word that it is true either, cause you're not declaring a
> variable for the Result.
> 
> Of course I am declaring a variable:
> 
> function X : String;
> 
> Now the (local) variable "Result" is of type "String".
> I use it in the same way as any other local variable.
> And because it is a manged type I could rely on the documentation
> which says that managed types are initialized (with zero length/nil).
> "Result" is used in the same way as a (local) variable.
> What should make me think that it is different?

Variables are declared with "var", a function result is not declared
with "var".


Regards,
Sven



More information about the fpc-pascal mailing list