delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/19/15:35:47

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Possible static data zeroisation bug in DJGPP v2?
Date: Tue, 17 Sep 1996 08:29:40 -0700
Organization: Alcyone Systems
Lines: 29
Message-ID: <323EC3E4.66DF79B8@alcyone.com>
References: <Pine DOT GSO DOT 3 DOT 94 DOT 960916131347 DOT 18588A-100000 AT zippy>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Samuel Vincent wrote:

> You must forgive me for my disbelief, but how can an "external" variable
> be initialized at all?  It's initialized elsewhere,  where it is
> defined, not declared (externally declared or not...)

An "external" means an entity declared with external linkage; in other words,
what normally is colloquially called a global.

> As far as static variables go, I don't have that info available, but
> it would make sense to zero it yourself anyway.  I believe ANSI says
> absolutely nothing is initialized unless you do it yourself.

Static, static external and external nonconglomerate variables _are_
guaranteed to be zeroed*.  I just don't know about conglomerate variables
(i.e., structures or unions).

It is certainly good style to initialize any values that you're counting on,
in any case.

--
* Note that is not always the safest thing.  The internal representation of a
null pointer, for instance, is not guaranteed to be all-bits zero by the
standard.

-- 
Erik Max Francis, &tSftDotIotE   http://www.alcyone.com/max/   max AT alcyone DOT com
San Jose, California   ICBM 37 20 07 N 121 53 38 W   R^4: the 4th R is respect
"Gods are born and die, but the atom endures."              -- Alexander Chase

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019