Cor Ligthert [MVP] wrote:
a pointer to computer memory address zero
or (as I assume)
a not yet set pointer (represented in VB.Net by the keyword Nothing)
<snip>
Which, AFAIK, happen to be exactly the same thing.
A pointer to the computer memory address 0 has the value of 0 (a
pointer, I suppose you know, *is* the value it points to), and a "not
yet set pointer" is exactly this, a reference value which was set to 0
-- upon initialization by the VB compiler generated code -- to mean
what other languages call "Null" and we call Nothing.
It became a convention to treat pointers (our "reference values") that
reference the special (and invalid) address 0 as non-initialized,
which is not exactly true: the pointer *was* initialized but to a
value known to be unusable.
Historically VB was one of the languages that always enforced this
notion, initializing the stack area to 0 and thus setting local
variables to a default, known value: 0, false, Nothing, etc. If
someone thinks this is not a big deal, compare it to Delphi, which
doesn't do this and requires you to initialize each and every local
variable before use (which is a major pain, and after you've done that
a zillion times you start looking for the compiler switch that
initializes the variables for you -- but there's none). C and C++ do
the same, but most compilers only warn you of the non-initilizion,
while others don't even bother to, so the programmer can happily use
values set to whatever was in the variable address at run time and
become appalled when things go awry with his/her code...
Uh, I guess I'm heavilly drifting to OT land now...
Regards,
Branco.