Mail Archives: djgpp/1997/06/12/18:19:40
Peter Palotas wrote:
>
> Hello, I am wondering how to make the operator "new" return NULL
> instead of throwing an exception when trying to allocate more memory
> than available.
> The following was cut from the C++ draft:
>
> T* p1 = new T; // throws bad_alloc if it fails
> T* p2 = new(nothrow) T; // returns 0 if it fails
>
> But the second example fails, saying that nothrow was undeclared. Is
> this a bug in DJGPP or is there some special headerfile that has to be
> included?
no, it is not a bug in djgpp ... djgpp is a port of gcc, as such it is
bound by what gcc supports ... i guess, as of 2.7.2.1, gcc does not
support the 'nothrow' option. i do not know if 2.8 supports it, i guess
you can check it out by going to fsf and searching. it takes time for
the standard to be implemented, you know.
and, btw, if you like djgpp so much, why the negative attitude?
--
Sinan
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:sinan DOT unur AT cornell DOT edu C ^
http://www.people.cornell.edu/pages/asu1/ \ ~/
Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************
- Raw text -