Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!samsung!uunet!seismo!morley.rutgers.edu!purtill From: purtill@morley.rutgers.edu (Mark Purtill) Newsgroups: comp.lang.c++ Subject: Re: C++ coding standards (Comment needed) Keywords: standard,variables Message-ID: Date: 23 Aug 90 17:23:03 GMT References: <2161@runxtsa.runx.oz.au> <183@logo.procase.UUCP> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 37 roger@procase.UUCP (Roger H. Scott) writes: >I will go one step >further in this direction and say that I wouldn't mind the ability to >un-declare a variable after I am "done" with it so that someone else (or me) >looking at the code later doesn't have to scan down to the end of the scope >to make sure there isn't some other, later use being made of this oh-so-local >variable. There is a way to do this; in fact, it was there in "plain" C; just declare the variable in a local group: int function() { /* ... */ { int a_very_local_variable ; /* use of a_very_local_variable */ } /* no uses of a_very_local_variable */ } This isn't eactly what you want (you can't overlap variables like: int a_very_local_variable ; ... int another_very_local_variable ; ... (undeclare a_very_local_variable) ; ... (undeclare another_very_local_variable) ; ... ) but it's still very useful sometimes when ones function is getting rather long, but can't be split easily. ^.-.^ Mark Purtill purtill@dimacs.rutgers.edu (201)932-4580 (O) ((")) P.O. Box 1179, Rutgers Univ., Piscataway, NJ 08855 (201)220-6905 (H) (Above information effective around 25 August 1990)