Ondrej Pokorny <laza...@kluug.net> schrieb am Sa., 24. März 2018, 20:49:
> This is not correct. Global simple variables are always initialized. At > least in Delphi it is so: > http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Variables_(Delphi) "If > you do not explicitly initialize a global variable, the compiler > initializes it to 0." > So, Delphi *does* document it. Okay, in that case the documentation needs to be updated, cause up to now the assumption has been that this is an implementation detail. ----- > > Another question about this sentence in FPC docs: "Managed types are > always initialized: in general this means setting the reference count to > zero, or setting the pointer value of the type to Nil." > > Does it mean I can assume a local string variable is always (=whenever > the routine is called) initialized to ''? I.e. that TestB always returns > 'a'? > For managed types this is indeed guaranteed. Otherwise there'd be exceptions upon the first use of the variable as the RTL would assume that the value is valid. Regards, Sven
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel