ADMB Documentation  11.5.3289
 All Classes Files Functions Variables Typedefs Friends Defines
newhand.cpp
Go to the documentation of this file.
00001 
00006 #if defined(__GNUC__) && (__GNUC__ < 4)
00007   #include <iostream.h>
00008   #include <new.h>
00009 #elif defined(_MSC_VER)
00010   #include <iostream>
00011   #include <new.h>
00012 #else
00013   #include <iostream>
00014   using namespace std;
00015   #include <new>
00016 #endif
00017 
00018 #include <admodel.h>
00019 
00020 extern "C"  {
00021 
00022 #if defined(_MSC_VER)   // will need to deal with different VC versions
00023 int adnewhandler(size_t i)
00024 #else
00025 void adnewhandler(void)
00026 #endif
00027 {
00028    cout << "Memory allocation error -- Perhaps you are trying to allocate too"
00029      " much memory in your program "<< endl;
00030    ad_exit(1);
00031 #if defined(_MSC_VER)   // will need to deal with different VC versions
00032    return 0;
00033 #endif
00034 }
00035 
00036 } // extern "C"
00037 
00042 void ad_set_new_handler (void)
00043 {
00044 #if defined(_MSC_VER)   // will need to deal with different VC versions
00045   _set_new_handler (adnewhandler);
00046 #else
00047   set_new_handler (adnewhandler);
00048 #endif
00049 }