Topic: new, exceptions and standard behavior
Author: hopps@yellow.mmm.com (Kevin J Hopps)
Date: Fri, 7 Jan 94 22:15:43 GMT Raw View
I have observations and questions.
We are using the SPARC C++ compiler and Solaris 2.3.
I have noticed the following things, and am wondering which, if any of them,
are covered by the C++ standard.
1) When new cannot get the memory, it throws an xalloc exception.
2) xalloc is derived from xmsg, and both are in a standard exception.h file
with many inline member functions.
3) xmsg::xmsg(const char*) allocates space dynamically to copy the text
into.
It seems silly to me that the exception thrown for an out-of-memory
condition attempts to allocate memory. Does the standard address this?
Should it?
--
Kevin J. Hopps e-mail: kjhopps@mmm.com
3M Company phone: (612) 737-3300
3M Center, Bldg. 235-3B-16 fax: (612) 737-2700
St. Paul, MN 55144-1000
Author: euamts@eua.ericsson.se (Mats Henricson)
Date: 10 Jan 1994 09:44:56 GMT Raw View
In article 757980732@mmm.com, hopps@yellow.mmm.com (Kevin J Hopps) writes:
>I have observations and questions.
>
>We are using the SPARC C++ compiler and Solaris 2.3.
>
>I have noticed the following things, and am wondering which, if any of them,
>are covered by the C++ standard.
>
>1) When new cannot get the memory, it throws an xalloc exception.
>2) xalloc is derived from xmsg, and both are in a standard exception.h file
> with many inline member functions.
>3) xmsg::xmsg(const char*) allocates space dynamically to copy the text
> into.
>
>It seems silly to me that the exception thrown for an out-of-memory
>condition attempts to allocate memory. Does the standard address this?
>Should it?
We are discussing this issue, but haven't decided yet. It seems like we will
not define how this will be done. It will perhaps be a "quality of
implementation" issue: well written compilers will make sure memory allocation
within xalloc will not fail.
Best regards,
Mats Henricson
Ellemtel Telecom Systems Labs
Stockholm
Sweden