[OpenAFS-devel] recent discussions about variable initialization expectations

Alexei Kosut akosut@cs.stanford.edu
Sat, 12 Apr 2003 14:13:36 -0700


On Sat, Apr 12, 2003 at 12:48:40PM -0500, Nathan Neulinger wrote:
> Basically, if a regular function variable, you have to initialize it if
> you want it's value to be anything other than garbage. Globals are
> initialized to null/zero.

As a clarification, the problem on Darwin (which is what I started
with originally) isn't actually about variable initialziation, but
about whether the global symbol gets exported.  I believe that (when
it is present), the global is properly initialized as zero.

OpenAFS will link and run correctly on Darwin with this:

    struct rxkad_stats rxkad_stats = {}

but not this:

    struct rxkad_stats rxkad_stats;

I really don't know why.

-- 
Alexei Kosut <akosut@cs.stanford.edu> <http://cs.stanford.edu/~akosut/>