Mail Archives: djgpp/1997/06/20/14:53:13
Chris wrote:
>
> My question is, what is the exact scope of a variable that is declared
> in a loop? Just wondering so I'll know what's legal, and what's not.
from the december draft:
3.3.2 Local scope [basic.scope.local]
...
4 Names declared in the for-init-statement, and in the condition of if,
while, for, and switch statements are local to the if, while, for, or
switch statement (including the controlled statement), and shall not
be redeclared in a subsequent condition of that statement nor in the
outermost block (or, for the if statement, any of the outermost
blocks) of the controlled statement; see _stmt.select_.
you can browse it on-line at www.cygnus.com. the reference for
_stmt.select_ above is
http://www.cygnus.com/misc/wp/dec96pub/stmt.html#stmt.select
-- Sinan
- Raw text -