Have this thing on my mind for a while... does the compiler initializes variables with some defaults ?
I wouldn't need to know all. I just need to know boolean. Is there a guarantee every boolean is initialized with False ?
Thing is, I would like to have defaults on objects, like a sort of an implicit constructor, so if I declare in a procedure, say var mySomething:TSomething, I would know mySomething gets automatically populated with default values on variables without me to explicitly call the constructor.
To me, explicit constructors sound absolutely ridiculous. IF constructor exectuion would be skipped if the object was tampered with, by a call to a method or a variable assignment, then constructors would make sense. You would begin any method with a constructor call to make sure defaults are set. Otherwise, there is no difference between procedure and constructor. Constructors are good on classes, but are nothing but cosmetic on objects. They just look fancy on the listing.
So, given that we don't have default constructors, and having an explicit constructor would rise the same question when writing it, "how do I know the object was intialized ?" inside constructor code, my question falls to something far simpler:
Are booleans always initialized to false ?
This way I can absolutely be sure that if I have an Initialized field in the object, this would automatically start on false, so i could call from all methods a procedure Init or constructor Init that would check on that and set some initial defaults.
So, is this the case, does the program initialize booleans always to false, or there is no initilization and that value is random on start ?