// (C) Porkolab 2003 // // A.4.5. // // Construction of statics struct X { X(int i) { x = i; std::cerr << x << std::endl; } int x; }; void f() { // std::cerr << "enter into f(), ix.x = " << ix.x << std::endl; static X ix(0); std::cerr << "enter into f(), ix.x = " << ix.x << std::endl; ++ix.x; if ( ix.x > 5 ) { static X iy(ix.x); static X iz(ix); // copy constructor } } int main() { for ( int i = 0; i < 10; ++i) f(); return 0; }