diff --git a/bad_alloc.cc b/bad_alloc.cc --- a/bad_alloc.cc +++ b/bad_alloc.cc @@ -27,7 +27,9 @@ int main (int argc, char **argv) { vector < int >v; + int i = 0; + char action; if (set_limit (20 * 1024 * 1024)) { @@ -39,11 +41,12 @@ for (;;) { v.push_back (i++); } - } catch (exception & e) { + } + catch (exception & e) { cout << e.what () << " after " << i << " iterations" << endl << endl; cout << "Would you like to see the full error message? (y/n) "; cin >> action; - v.clear(); + v.clear (); switch (action) { case 'y': throw;