Mazola Winstrol wrote:
1 - Does the compiler automatically initialize all class fields when a new instance is created?
They're called instance fields, and yes, they are zeroed. Class fields are fields that that are unique per class type, rather than per instance.
2 - Does the compiler initialize record fields?
Only for fields that are managed types.
3 - When i declare a pointer as a global variable or as a member of a record, can i assume that its initial value is nil?
No.
4 - Is there any compiler switch regarding initialization of variables?
There is only -gt, but it "initialises" (non-managed) variables and out-parameter with random data in order to more easily find cases of uninitialised data. It cannot be used to initialise all variables to a known value.
Jonas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal