Michael Van Canneyt wrote:
[questions 1-3 and Michael's responses snipped]
Show quoted text 34 lines
It does not compile because of the "nil"...changing it to "abc" works.
Show quoted text 18 lines
One of the cardinal rules of programming is to initialize local variables...else the results can be unpredictable and hard to debug. The concept of having the compiler do this, via a construct such as a typed constant (or better yet, a var with an initialization value) is something I've wanted for years. I'm disappointed to hear that this is NOT the case with FPC, and that these constructs initialize only at the global (i.e. program start) level.
What, pray tell, does that imply for a LOCAL typed constant? Where is the devilish thing stored, if not on the stack? Does it get stored globally? If so, that means that different (or recursive) invocations of the procedure will be operating on this variable in a counter-intuitive way. If this is so, I see no reason to ever place one of them in any local declaration [unless I wish to confuse myself :) ].
I recommend to the compiler guys (when schedule permits) implementing the compiler initilization of local variables (which have an initialization value declared)...that is, it gets initialized when it gets pushed onto the stack.
In the meantime, I suggest that the documentation be clarified with respect to what is and what is not happening in this matter.
Happy New Year!
Mark
