Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 2nd, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Operator new with nothrow option still throws exception
  2. #include <iostream>
  3.  
  4. int main(){
  5.     for(;;){
  6.         int* ptr = new (std::nothrow) int;
  7.         if(ptr == 0){
  8.             std::cout << 0 << std::endl;
  9.             break;
  10.         }
  11.     }
  12.     std::cin.get();
  13.     return 0;
  14. }