Well, it is quite obvious that "initializing" means different things to different people.
The only meaning of "initialization" that matters is that of the compiler. You need to explicitly
assign a value to local variables (by means of
:= or
out) or they'll contain garbage from the stack and the compiler will rightfully complain.
Just use MyVar := Default(TypeOfVar).
In most non-trivial applications, this just might simply not work, as it assumes that this is a local variable that gets initialized "once", and as I mentioned elsewhere already, twice, such a "default" by the compiler might simply not be what the application needs at runtime...
This is equivalent to
FillChar(MyVar, SizeOf(MyVar), 0) but won't emit any warnings since it is an actual assignment.
And your default initialization isn't helping, as I have a lot of cases where "default initialization" of an array/string/record can differ depending on what the target encoding is. It might not be obvious for a lot of whippersnappers, but ASCII and EBCDIC, for example, are quite different. And your example might work for a simple (ASCII) string, but not for any more complex data structure...
I gave an example on the documentation of
out parameters (which you obviously didn't read) and that's it. I didn't tell you to initialize your EBCDIC strings (or whatever) that way. Apart from that, default initialization of an array or string will
never differ depending on the target encoding because default-initialized instances of those types are
empty. Pray tell me, what's the encoding of this string:
'' ?
Now I wonder what witchcraft your "initialization" code performs. Quoting
@Thaddy:
Can you provide an example this time? I doubt it. (because you never do out of incompentence)