From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Porting (was ADA and Pascal etc) Date: 1997/11/09 Message-ID: #1/1 X-Deja-AN: 288112047 X-NNTP-Posting-Host: pogner.demon.co.uk [158.152.70.98] References: <34557f2b.1934172@news.mindspring.com> <63d5l4$tub$1@helios.crest.nt.com> <878495810snz@genesis.demon.co.uk> <63ocs9$835$1@darla.visi.com> Organization: At Home Newsgroups: comp.lang.ada,comp.lang.c Date: 1997-11-09T00:00:00+00:00 List-Id: seebs@plethora.net (Peter Seebach) writes: > In article , > Simon Wright wrote: > >How does the C++ style localise scope? With the exception of variables > >declared in "for" loops, the scope's from the point of declaration to > >the end of the current block, not so? > > Of course not! How could anyone be so *stupid* as to think that > the clear explanation in the ARM is correct? C++ being a very stable > language, and well designed at all times, the scope of the variable > is the for loop; it goes out of scope after the for loop's statement. I think you're accusing me of something I didn't say! { // code with no access to j int j = 4; // code that can access j for (int k = 3; k < 5; k++) { // code that can access j and k } // code that can access j *but not k* } // j no longer accessible and my point was that "code that can access j *but not k*" is as long as a piece of string .. -- Simon Wright Work Email: simon.j.wright@gecm.com GEC-Marconi Radar & Defence Systems Voice: +44(0)1705-701778 Command & Information Systems Division FAX: +44(0)1705-701800