Einzelnen Beitrag anzeigen

mjustin

Registriert seit: 14. Apr 2008
3.005 Beiträge
 
Delphi 2009 Professional
 
#6

AW: boolean function: muss result := false gesetzt werden?

  Alt 1. Dez 2022, 20:29
Lokale Variablen mit Referenzzählung werden immer mit nil (oder '') initialisiert. Alle anderen muss man selber initialisieren.

Zitat:
Local reference-counted* variables are always initialized to nil or '';
https://stackoverflow.com/a/132770/80901


Barry Kelly schrieb dazu:
Zitat:
Local variables are initialized as if they were passed to the Initialize routine. The Initialize routine uses runtime type-info (RTTI) to zero-out fields (recursively - if a field is of an array or record type) and arrays (recursively - if the element type is an array or a record) of a managed type, where a managed type is one of:

AnsiString
UnicodeString
WideString
an interface type (including method references)
dynamic array type
Variant
https://stackoverflow.com/a/861178/80901
Michael Justin
habarisoft.com

Geändert von mjustin ( 1. Dez 2022 um 20:45 Uhr)
  Mit Zitat antworten Zitat