Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!pequod.cso.uiuc.edu!dorner From: dorner@pequod.cso.uiuc.edu (Steve Dorner) Newsgroups: comp.sys.mac.programmer Subject: Re: For Loops, Summary Message-ID: <1991Jan22.191628.29221@ux1.cso.uiuc.edu> Date: 22 Jan 91 19:16:28 GMT References: <6968@crash.cts.com> <20058@unix.SRI.COM> Sender: news@ux1.cso.uiuc.edu (News) Organization: University of Illinois at U-C Lines: 20 >Loop variables are usually allocated in cpu registers and thus their >value is not guarranteed outside the loop. The registers might or might >not get trashed immediately after the last statement in the loop. Read >the documentation of your compiler. WRONG. In Pascal perhaps, but not in C. You can depend on the fact that: main() { short i; for (i=0;i<8;i++); printf("%d\n",i); } will print "8". The storage class of the variable has nothing to do with it, either. -- Steve Dorner, U of Illinois Computing Services Office Internet: s-dorner@uiuc.edu UUCP: uunet!uiucuxc!uiuc.edu!s-dorner