![]() Chapter Contents |
![]() Previous |
![]() Next |
| Handling Exceptions in SAS/C |
#include #include
void throwit()
{
// this allocation is expected to be unlikely to succeed
// this should throw std::bad_alloc
char* p = new char[256*1024*1024];
delete [] p;
}
int main()
{
try
{
throwit();
}
catch ( const std::exception& e )
{
if ( !std::exception::is_xtraced() )
{
cerr << "xtrace() information follows for class "
<< e.what()
<< endl;
std::exception::xtrace();
}
}
}
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.