🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Tiaan Wessels Thu, 18 Jan 1996 18:18
Scope rules in new ANSI for lookup
#3040
Author: Tiaan Wessels
Date: Thu, 18 Jan 1996 18:18
12 lines
1153 bytes
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.

-- 
Tiaan Wessels
tiaan@inetsys.alt.za
Netsys International
---
[ 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. ]
Re: Scope rules in new ANSI for lookup
#3043
Author: 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. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads