Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: Declaration within a loop. Message-ID: <8323@goofy.megatest.UUCP> Date: 27 Sep 89 22:49:38 GMT References: <27519@amdcad.AMD.COM> Distribution: usa Organization: Megatest Corporation, San Jose, Ca Lines: 21 From article <27519@amdcad.AMD.COM>, by tim@cayman.amd.com (Tim Olson): ... > > But sometimes it is better to declare the variable in the block to > limit its scope rather than to make every variable visible to the > entire function. Why did you not say, "Always it is better to declare..."? The only reason I can think of not to put variables into the most restrictive scope that will contain them is that dbx has a bug that causes it to give wrong results without complaint or warning if you use the same name in two scopes. There's nothing more sickening than to be confronted by an enemy procedure with a skillion variables declared at the top. Usually they have generic names like, "temp1", and "ptr". Well okay, maybe there's one thing more sickening than that, but I don't see any reason to bring Jerry Lewis into this.