Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!steinmetz!ge-dab!codas!killer!richardh From: richardh@killer.UUCP (Richard Hargrove) Newsgroups: comp.lang.c Subject: Re: How are local vars allocated? Message-ID: <2230@killer.UUCP> Date: Fri, 27-Nov-87 09:29:17 EST Article-I.D.: killer.2230 Posted: Fri Nov 27 09:29:17 1987 Date-Received: Mon, 30-Nov-87 00:43:48 EST References: <9367@mimsy.UUCP> <1633@megatest.UUCP> <2218@killer.UUCP> Organization: The Unix(R) Connection, Dallas, Texas Lines: 35 Summary: I was wrong In article <2218@killer.UUCP>, richardh@killer.UUCP (Richard Hargrove) writes: > In article <1987Nov22.085210.20641@sq.uucp>, msb@sq.uucp (Mark Brader) writes: > > There have been several followups regarding the code: > > (deleted) > > The above requests that a new variable "k" be created, and destroyed > > again, on each iteration of the loop. Since it is destroyed each time, > > No it doesn't! It requests that a variable "k" be allocated and be visible > > > > > But the value of "k" is NOT guaranteed to be retained from one iteration > > to the next, and you must not assume it will be. If you want that, you > > Yes it is! The variable's scope is the block in which it is defined. > Time for some humble pie along with all the other Thanksgiving deserts. I am obviously in error. If my claim above were true then objects declared local to the block would be visible to the loop control code, which they obviously aren't. Hope I don't need too much flame retardant. richard hargrove ...!killer!richardh ------------------- Found on a Post-It attached to the front of a terminal in a deserted office in downtown Wichita: "Aunty Em, Hate you. Hate Kansas. Took the dog. Dorothy" ---------------------------------------------