Topic: scope of variable defined in loop


Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 12 Mar 1995 17:39:24 GMT
Raw View
rdo@elt.com (Randy Oxentenko) writes:

>According to the current working paper, if I define a variable inside an
>expression for a loop, the scope of that variable is limited to the loop
>itself, right?  In other words, in "for (int i=0; i<5; i++) {}", i
>disappears at the closing brace of the for statement.  About when did
>this change?

The C++ Committee adopted this change last year. It may take a while
for the change to appear in your favorite compiler.

>Question 2: Not being a member of the ANSI committee myself, what is my
>best source of information about the current draft of the standard for
>C++?

Various magazines, particularly "C++ Report" and "C/C++ Users Journal",
publish articles about the state of the standardization effort.

In late April, a draft standard will be made available on a public FTP
site. To find out how you can get a a copy, and how to submit comments
for consideration by the ANSI C++ Committee X3J16, send email to
 c++std-notify@research.att.com
(If not yet established, this address will be available soon.)

You will be placed on a mailing list, and will be notified automatically
when the draft is available and where to get it, along with instructions
for submitting comments.

The "notify" address serves only to place you on a notification mailing
list. The contents of your email will not be read or saved.

--
Steve Clamage, stephen.clamage@eng.sun.com




Author: rdo@elt.com (Randy Oxentenko)
Date: Thu, 9 Mar 1995 21:13:16 GMT
Raw View
According to the current working paper, if I define a variable inside an
expression for a loop, the scope of that variable is limited to the loop
itself, right?  In other words, in "for (int i=0; i<5; i++) {}", i
disappears at the closing brace of the for statement.  About when did
this change?

Question 2: Not being a member of the ANSI committee myself, what is my
best source of information about the current draft of the standard for
C++?
--
Randy Oxentenko     | Most people would rather be treated courteously than
Email: rdo@elt.com  | loved... Consider how few knifings and shootings are
Opinions are mine   | the result of etiquette as compared to passion.
alone, not ELT's.   |                                    -- P. J. O'Rourke