🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3043

Re: Scope rules in new ANSI for lookup

#3043
From: Alun Champion
Date: Thu, 18 Jan 1996 19:08
31 lines
1626 bytes
In article <30FE0827.52A0C2CF@inetsys.alt.za> Tiaan Wessels <tiaan@inetsys.alt.za> writes:

: Can someone please enlighten me on the new ANSI 'for' scoping's name
: lookup rules. A lot of my code seems not to work when compiled with a
: compiler ( gcc.2.7.x ) that implements this.

Sure.

6.5.3 The for statement
...
 4 If the for-init-statement is a declaration, the scope of the name(s)
   declared extends to the end of the for-statement. [Example: 
	int i = 42;
	int a[10];

	for (int i = 0; i < 10; i++) 
	    a[i] = i;

	 int j = i; // j = 42
   -end example]
...

Regards

   -A.
-- 
| A.Champion                |
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <ALUN.CHAMPION.96Jan18141354@g7240065.bridge.bst.bls.com>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <30FE0827.52A0C2CF@inetsys.alt.za>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
Newsgroups: comp.std.c++
Subject: Re: Scope rules in new ANSI for lookup
Date: 18 Jan 1996 11:08:41 PST
Organization: Computer People Inc.
Approved: austern@isolde.mti.sgi.com
Message-ID: <ALUN.CHAMPION.96Jan18141354@g7240065.bridge.bst.bls.com>
References: <30FE0827.52A0C2CF@inetsys.alt.za>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 18 Jan 1996 19:13:54 GMT
In-Reply-To: Tiaan Wessels's message of 18 Jan 1996 10:18:44 PST
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMP6a3ky4NqrwXLNJAQHP8wH/S4zSBEossf6lz7aHKyYbSu2cmY7l/ALf
 bE2hdEVWH5VDy7wobfknb5YWhgJzBeQUMJ2PSRVSuHh0EHmNnU+j5A==
 =IN/2
Originator: austern@isolde.mti.sgi.com