Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 97 16:47:13 -0400
From:      Garance A Drosehn <gad@mlor.its.rpi.edu>
To:        Terry Lambert <terry@lambert.org>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Variable initialization
Message-ID:  <9705212047.AA07750@mlor.its.rpi.edu>
References:  <199705191630.JAA24310@phaeton.artisoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > A wrongly initialized variable is worse than an initialized
> > one since it can't be checked for.
> 
> Won't an incorrect initialization become obvious when the code
> fails to function?

Not necessarily.

In the days when mainframes ruled the earth, here at RPI we ran an
operating system called MTS.  One difference between MTS and standard
IBM operating systems was that IBM generally initialized storage
to zero, while we initialized it to X'81818181'.  Compilers weren't
smart enough to warn about variables which were not explicitly
initialized at compile time.  So, if you did not initialize your
variables, you'd get different results under MTS than under some
other operating systems.

In some of those cases, the uninitialized variables really were
expected to be zero, and the programmer just never initialized it.
In other cases, however, the initial value was *not* supposed to
be zero, but since the program had worked no one realized the
answers were wrong.  In a few cases we had people who refused to
believe that their code was wrong (even if we explicitly showed
them the problem), because they had already built things based on
the incorrect results they had gotten by running the program on
other systems, and they simply did not want to believe that all
their work had been completely misguided.

There is a significant difference between "fails to function" and
"functions perfectly fine with absolutely no errors, but just
happens to give you the wrong answers"...

---
Garance Alistair Drosehn     =     gad@eclipse.its.rpi.edu
Senior Systems Programmer        (MIME & NeXTmail capable)
Rensselaer Polytechnic Institute;           Troy NY    USA



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9705212047.AA07750>