From: Jeff Taylor Newsgroups: comp.os.msdos.djgpp Subject: Re: djgpp bug Date: Wed, 28 May 1997 10:45:51 -0700 Organization: University of California, Davis Lines: 20 Message-ID: <338C6F4F.70AE@dcn.davis.ca.us> References: NNTP-Posting-Host: dcn73.dcn.davis.ca.us Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk This is for backward compatibility. In pre-ANSI C, external declarations were very shaky and ill-defined. What you have found was the way it was expected to work. The statement "int name;" was a definition (i.e., the same as "extern int name;") in some compilers and a declaration (with space allocation) in others. "int name = 0;" was the most portable way to force allocation. Jeff KOMODakis Nikolaos wrote: > > I have accidentally found the following bug in djgpp: > If you declare the same global (not static) variable in two different C > files, the compiler doesn't tell you anything (not even a warning). > However, it allocates the same space for the two definitions. > > I guess that this is a problem of the COFF format (that djgpp uses) and > the way this format handles global variables. > > .. Nick ...