From: leathm AT solwarra (Leath Muller) Message-Id: <199609170101.LAA14759@gbrmpa.gov.au> Subject: Re: Possible static data zeroisation bug in DJGPP v2? To: csrabak AT dce03 DOT ipt DOT br (Cesar Scarpini Rabak) Date: Tue, 17 Sep 1996 11:01:08 +1000 (EST) Cc: djgpp AT delorie DOT com In-Reply-To: <1.5.4.16.19960916173527.29e7e9f6@dmeasc.rc.ipt.br> from "Cesar Scarpini Rabak" at Sep 16, 96 08:33:51 pm Content-Type: text > >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...) > Have you heard about a piece of code that runs BEFORE the very fisrt line of > your program runs (in DJGPP is in crt0.o...) the C Run Time start up code? > One of its functions is precisely to do this chore. Correct me if I'm wrong, but wasn't this changed so that it _did not_ zero the code for performance reasons? (I actually think this was part of Quake ie: id needed some more performance, so taking out the zeroing of allocated memory was used to help speed things up a bit). I think you now specify that you want it zeroed as part of the __crt0_startup_flags (I cant verify this, I have never needed to test it) > >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. > Sorry, but the Standard says the converse. Whatever. It doesn't really matter. (No flames...this is a comment.) Zeroing would HAVE to occur on UNIX machines because of security issues... and because UNIX is a multi user machine. A PC running DOS is generally a single user machine, so its for this reason that security isn't a problem, so taking out the zeroing is not a problem. Moral of the story: If you want something zeroed, either zero it yourself, or stick it in the startup flags (if you can stick it in the startup flags ;) Leathal.