다음을 통해 공유


set_unexpected (<exception>)

새 설정 unexpected_handler 할 때 예기치 않은 예외가 발견.

unexpected_handler
   set_unexpected(
      unexpected_handler _Pnew
   ) throw( );

매개 변수

  • _Pnew
    함수에서 호출

반환 값

이전 주소 unexpected_handler.

설명

_Pnew포인터를 null이 아니어야 합니다.

C + + 표준에서는 필요 unexpected 예외를 throw 하는 목록에 없는 함수를 throw 할 때 호출 됩니다.현재 구현에서는이 지원 하지 않습니다.다음 예제에서는 호출 unexpected 다음 직접 호출을 unexpected_handler.

예제

// exception_set_unexpected.cpp
// compile with: /c /EHsc
#include<exception>
#include<iostream>

using namespace std;

void unfunction( ) 
{
   cout << "I'll be back." << endl;
   terminate( );
}

int main( ) 
{
   unexpected_handler oldHand = set_unexpected( unfunction );
   unexpected( );
}
  
  
  

요구 사항

Header: <exception>

네임 스페이스: std