Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
NO_FOR_LOCAL_SCOPE.cpp
Go to the documentation of this file.
1// checking for scope of for-init-statements
2
3
25int foo (int n)
26{
27 int result = 0;
28
29 // 6.5.3, p3, the scope of `i' extends to the end of
30 // the for-statement (and not beyond)
31 for (int i = 0; i != n; ++i)
32 result += i;
33
34 // check to see if i is still in scope here
35 // if so, the test will compile succesfully
36 // indicating a failure
37 result *= i;
38
39 return result;
40}
#define i
Definition 17.names.cpp:126
#define n
Definition 17.names.cpp:130
volatile int result
#define foo(buf, s,...)