Debian Codegraph @

cmake/cxx_tests/old_for_scoping.cpp

raw
1 // DESCRIPTION
2 //
3 // Test to check whether the C++ compiler accepts the old for scoping rules (the scope of a
4 // variable declared inside the parentheses extends outside the for-body).
5 // Note that some compilers (notably g++ and egcs) support both new and old rules since they
6 // accept the old rules and only generate a warning.
7 // In sync with AC_CXX_OLD_FOR_SCOPING (2008-04-12).
8 //
9 // COPYLEFT
10 //
11 // Copyright (c) 2009 Theo Papadopoulo <[email protected]>
12 // Copyright (c) 2008 Todd Veldhuizen
13 // Copyright (c) 2008 Luc Maisonobe <[email protected]>
14 //
15 // Copying and distribution of this file, with or without modification, are
16 // permitted in any medium without royalty provided the copyright notice
17 // and this notice are preserved.
18
19 int main() {
20 int z;
21 for (int i=0; i < 10; ++i)
22 z=z+i;
23 z=i;
24 return z;
25 }