To: Henrik Storner Cc: S_Eckart AT lis DOT e-technik DOT tu-muenchen DOT de (Stefan Eckart), djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: strange linker behavior Date: Wed, 21 Sep 94 09:22:11 +0200 From: eliz AT is DOT elta DOT co DOT il > So the 'delay' variable is uninitialized, and the output is therefore random. > Indeed, changing the declaration in your sample program to > > static int delay; > > produces '0' as output, with DJGPP 1.12.maint2. As others have already replied, `delay' should be zero even if not declared static, because it is declared outside any function. The `static' thing only makes it private to the source file it is declared in, and therefore avoids the ``bug'' caused by its linkage to the library-defined name. In addition to what've been said about this by others, there is a lesson here: any global variable which is not used across source files, should be *always* declared static, to minimize a possibility of a name clash with other global symbols. Being defensive never hurts much, but generally helps a lot. Eli Zaretskii