diff options
author | Steve Huston <shuston@riverace.com> | 2002-08-23 22:39:04 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2002-08-23 22:39:04 +0000 |
commit | cfc877e7bece5599a3c03aa80b3aa9b9542623bf (patch) | |
tree | cb2ffab8a6a62f3d6c6428057265b0dd025c4e7a /ace/config-all.h | |
parent | bac2d01866ab5f11c250985b7bd8b04c4dad51c2 (diff) | |
download | ATCD-cfc877e7bece5599a3c03aa80b3aa9b9542623bf.tar.gz |
ChangeLogTag:Fri Aug 23 18:20:31 2002 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace/config-all.h')
-rw-r--r-- | ace/config-all.h | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/ace/config-all.h b/ace/config-all.h index eebffb9a9e7..830bc638d02 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -336,131 +336,6 @@ #endif /* __sgi || ghs || ..... */ // ============================================================================ -// ACE_NEW macros -// -// A useful abstraction for expressions involving operator new since -// we can change memory allocation error handling policies (e.g., -// depending on whether ANSI/ISO exception handling semantics are -// being used). -// ============================================================================ - -#if defined (ACE_NEW_THROWS_EXCEPTIONS) - -// Since new() throws exceptions, we need a way to avoid passing -// exceptions past the call to new because ACE counts on having a 0 -// return value for a failed allocation. Some compilers offer the -// new (nothrow) version, which does exactly what we want. Others -// do not. For those that do not, this sets up what exception is thrown, -// and then below we'll do a try/catch around the new to catch it and -// return a 0 pointer instead. - -# if defined (__HP_aCC) - // I know this works for HP aC++... if <stdexcept> is used, it - // introduces other stuff that breaks things, like <memory>, which - // screws up auto_ptr. -# include /**/ <new> - // _HP_aCC was first defined at aC++ 03.13 on HP-UX 11. Prior to that - // (03.10 and before) a failed new threw bad_alloc. After that (03.13 - // and above) the exception thrown is dependent on the below settings. -# if (HPUX_VERS >= 1100) -# if (((__HP_aCC < 32500 && !defined (RWSTD_NO_NAMESPACE)) || \ - (__HP_aCC >= 32500 && defined (_HP_NAMESPACE_STD))) \ - || defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)) -# define ACE_bad_alloc std::bad_alloc -# define ACE_nothrow std::nothrow -# define ACE_nothrow_t std::nothrow_t -# else -# define ACE_bad_alloc bad_alloc -# define ACE_nothrow nothrow -# define ACE_nothrow_t nothrow_t -# endif /* __HP_aCC */ -# elif ((__HP_aCC < 12500 && !defined (RWSTD_NO_NAMESPACE)) || \ - (__HP_aCC >= 12500 && defined (_HP_NAMESPACE_STD))) -# define ACE_bad_alloc std::bad_alloc -# define ACE_nothrow std::nothrow -# define ACE_nothrow_t std::nothrow_t -# else -# define ACE_bad_alloc bad_alloc -# define ACE_nothrow nothrow -# define ACE_nothrow_t nothrow_t -# endif /* HPUX_VERS < 1100 */ -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# elif defined (__SUNPRO_CC) -# if (__SUNPRO_CC < 0x500) || (__SUNPRO_CC_COMPAT == 4) -# include /**/ <exception.h> - // Note: we catch ::xalloc rather than just xalloc because of - // a name clash with unsafe_ios::xalloc() -# define ACE_bad_alloc ::xalloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc ("no more memory") -# else -# include /**/ <new> -# define ACE_bad_alloc std::bad_alloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# endif /* __SUNPRO_CC < 0x500 */ -# elif defined (__BORLANDC__) || defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -# include /**/ <new> -# define ACE_bad_alloc std::bad_alloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# else -# include /**/ <new> -# define ACE_bad_alloc bad_alloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# endif /* __HP_aCC */ - -# if defined (ACE_HAS_NEW_NOTHROW) -# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ - do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ - } while (0) -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { POINTER = new(ACE_nothrow) CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return; } \ - } while (0) -# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ - do { POINTER = new(ACE_nothrow) CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; } \ - } while (0) - -# else - -# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0; return RET_VAL; } \ - } while (0) - -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0; return; } \ - } while (0) - -# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0; } \ - } while (0) -# endif /* ACE_HAS_NEW_NOTHROW */ - -#else /* ACE_NEW_THROWS_EXCEPTIONS */ - -# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ - } while (0) -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return; } \ - } while (0) -# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; } \ - } while (0) - -# define ACE_throw_bad_alloc \ - void* gcc_will_complain_if_literal_0_is_returned = 0; \ - return gcc_will_complain_if_literal_0_is_returned - -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - -// ============================================================================ // ACE_ALLOC_HOOK* macros // // Macros to declare and define class-specific allocation operators. |