Zeigt mir gerne wo steht, dass *ALLE* Variablen und Objekte stets mit 100% Zuverlässigkeit mit NIL, 0 oder "" initialisiert werden.
Das ist eindeutig dokumentiert:
https://docwiki.embarcadero.com/RADS...ables_(Delphi)
Zitat:
If you do not explicitly initialize a global variable, the compiler initializes it to 0. Object instance data (fields) are also initialized to 0. On the Wiin32 platform, the contents of a local variable are undefined until a value is assigned to them.
When you declare a variable, you are allocating memory which is freed automatically when the variable is no longer used. In particular, local variables exist only until the program exits from the function or procedure in which they are declared.
Anders sieht es bei referenzgezählten Datentypen aus (strings, Interfaces, ...). Die werden auch lokal mit 0 initialisiert, was einfach daran liegt, dass ansonsten bei der ersten Zuweisung versucht würde, den alten Speicher freizugeben (obwohl der Wert gar nicht gültig wäre).