January 22, 2004
Rolf Hemmerling wrote:
>     set_terminate( exitus );
>                             ^
> ...\..\src\data\exception\Exception.cpp(153) : Error: undefined identifier 'set_terminate'
>     set_unexpected( wasIstLos );
>                                 ^
> ...\..\src\data\exception\Exception.cpp(217) : Error: undefined identifier 'set_unexpected'

Both are defined in eh.h as it seems...
I just hope they exist in the library.
So, indeed for these you would have to include eh.h

>           throw runtime_error ("Geht nicht");
> *********************

runtime_error is not defined anywhere as far as I can tell.
Including stlport indeed probably will not help you a lot. For the time being you could implement a class runtime_error yourself...

> So if I setup the right include path, the include files are found, but are not sufficent.
> 
> So I think that the STLlib does NOT help with "set_terminate()" and "runtime_error" :-(.
> 
> Support for "set_terminate()" is by
> #include <eh.h>
> of the standard non-STL include files,
> , but there is no support for "runtime_error" ? :-(.
> 
> Any suggestions ?
> 
> Sincerely
> Rolf
> 


-- 
ManiaC++
Jan Knepper

But as for me and my household, we shall use Mozilla... www.mozilla.org
January 23, 2004
Rolf Hemmerling wrote:

> Hello !
> 
> At first, my starting-C++ project is a multi-compiler project.
> So with the "same" very-complicated makefile and a common header file,
> 
> I succeeded with OTHER compilers to include those header files which contain the definitions for "set_terminate()" and "runtime_errror".
> 
> For example, with OpenWatcom, this
> 
> *****
> class _WPRTLINK runtime_error : public exception {
> public:
>      runtime_error( string const& what_arg ) _WCTHROWS(())
>          : exception( what_arg ) {
>      }
> };
> ****
> 
> defines the "runtime_error" in the proper header files, which I did not find with MingW, MS VC++4.0 and DMC !
> 
> So if I include
> #include <stdexcept>
> #include <exception>
> , these files ARE found by the compiler, nethertheless they donĀ“t
> contain the proper information to support "set_terminate()" and
> "runtime_error" ( as I said, this is **standard library stuff", as the
> actions of the standard libarary operations are controlled by try..catch
> with "runtime_error" ect.
> 
> here are the error messages:
> 
> *********************
>      set_terminate( exitus );
>                              ^
> ..\..\src\data\exception\Exception.cpp(153) : Error: undefined
> identifier 'set_terminate'
>      set_unexpected( wasIstLos );
>                                  ^
> ..\..\src\data\exception\Exception.cpp(217) : Error: undefined
> identifier 'set_unexpected'
>            throw runtime_error ("Geht nicht");
> *********************
> 
> So if I setup the right include path, the include files are found, but are not sufficent.
> 
> So I think that the STLlib does NOT help with "set_terminate()" and
> "runtime_error" :-(.

1. Make sure your IDDE include path is set as follows:

\dm\stlport\stlport;\dm\include;\dm\include\win32

or the includes to the command line version look like:

-I\dm\stlport\stlport -I\dm\include -I\dm\include\win32

2. It's "std::set_terminate", not "set_terminate". Likewise, it's "std::set_unexpected".

3. There does seem to be a bug in the DMC runtime library, because set_unexpected and std::set_unexpected are both undefined. Work around this problem as follows:

#if !defined(__SC__) && !defined(__DMC__)
  set_unexpected(wasIstLos);
#endif

Welcome to the wonderful world of porting code!

-scooter
January 23, 2004
Hello !

Jan Knepper wrote:

>>           throw runtime_error ("Geht nicht");
>> *********************
> runtime_error is not defined anywhere as far as I can tell.
> Including stlport indeed probably will not help you a lot. For the time being you could implement a class runtime_error yourself...
So you see ALL the standard exceptions

 exception <--- bad_cast
//                 bad_alloc
//                 bad_exception
//                 bad_typeid     <--- __non_rtti_object
//                 logic_error    <--- domain_error
//                                     invalid_argument
//                                     length_error
//                                     out_of_range
//                 runtime_error <---- overflow_error
//                                     range_error
//                                     underflow_error

are all not available with oldfashioned MS VC++ 4.0 and with DMC, and this makes ( the standard library of ) DMC "oldfashioned".

And so even though I am just a beginner with C++, does not give arguments to support DMC with my projects.

Or, vice-versa, I must avoid "standard" c++ features with my project, to support DMC.

As self-written exceptions are supported, probably its a lack of the system library of the compiler ?

Any other suggestions ?

Sincerely
Rolf

-- 
      /   /    / Alone on the data highway...
    /        /   like on an allee in Hannover-Herrenhausen
  /    /   /     The Hemmerling (R) WEB site - Rolf Hemmerling,Germany
/    /   /       http://www.hemmerling.com/

January 26, 2004
"Rolf Hemmerling" <hemmerling@gmx.net> wrote in message news:bulkfe$501$1@digitaldaemon.com...
> Hello !
>
> How to catch runtime errors with DigitalMars C++ ?

What's happening is the global new operator is not throwing an exception when it fails to allocate the memory, it returns NULL instead. This is a bug in the runtime library.


1 2
Next ›   Last »