// Does not compile with old compilers such as Borland C++ 5 // Exception Handling #include #include void main() { int* ptr; try { for(;;) ptr = new int; } catch ( bad_alloc ) { cerr << "new: unable to allocate storage. Bye\n"; exit( EXIT_FAILURE ); } }