- Adds note directing users of U_NO_THROW to U_NOEXCEPT.
class MaybeStackArray {
public:
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NO_THROW = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
#endif
/**
class MaybeStackHeaderAndArray {
public:
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NO_THROW = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
#endif
/**
#define __UOBJECT_H__
#include "unicode/utypes.h"
+#include "unicode/platform.h"
/**
* \file
/**
* \def U_NO_THROW
- * Define this to define the throw() specification so
+ * Since ICU 64, use U_NOEXCEPT instead.
+ *
+ * Previously, define this to define the throw() specification so
* certain functions do not throw any exceptions
*
* UMemory operator new methods should have the throw() specification
* constructor is still called, and if the constructor references member
* data, (which it typically does), the result is a segmentation violation.
*
- * @stable ICU 4.2
+ * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422.
*/
#ifndef U_NO_THROW
#define U_NO_THROW throw()
* for ICU4C C++ classes
* @stable ICU 2.4
*/
- static void * U_EXPORT2 operator new(size_t size) U_NO_THROW;
+ static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT;
/**
* Override for ICU4C C++ memory management.
* See new().
* @stable ICU 2.4
*/
- static void * U_EXPORT2 operator new[](size_t size) U_NO_THROW;
+ static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT;
/**
* Override for ICU4C C++ memory management.
* for ICU4C C++ classes
* @stable ICU 2.4
*/
- static void U_EXPORT2 operator delete(void *p) U_NO_THROW;
+ static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT;
/**
* Override for ICU4C C++ memory management.
* See delete().
* @stable ICU 2.4
*/
- static void U_EXPORT2 operator delete[](void *p) U_NO_THROW;
+ static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT;
#if U_HAVE_PLACEMENT_NEW
/**
* See new().
* @stable ICU 2.6
*/
- static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NO_THROW { return ptr; }
+ static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; }
/**
* Override for ICU4C C++ memory management for STL.
* See delete().
* @stable ICU 2.6
*/
- static inline void U_EXPORT2 operator delete(void *, void *) U_NO_THROW {}
+ static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {}
#endif /* U_HAVE_PLACEMENT_NEW */
#if U_HAVE_DEBUG_LOCATION_NEW
/**
* @param file The file where the allocation was requested
* @param line The line where the allocation was requested
*/
- static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NO_THROW;
+ static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT;
/**
* This method provides a matching delete for the MFC debug new
*
* @param file The file where the allocation was requested
* @param line The line where the allocation was requested
*/
- static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NO_THROW;
+ static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT;
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
#endif /* U_OVERRIDE_CXX_ALLOCATION */
* and replace with uprv_malloc/uprv_free.
*/
-void * U_EXPORT2 UMemory::operator new(size_t size) U_NO_THROW {
+void * U_EXPORT2 UMemory::operator new(size_t size) U_NOEXCEPT {
return uprv_malloc(size);
}
-void U_EXPORT2 UMemory::operator delete(void *p) U_NO_THROW {
+void U_EXPORT2 UMemory::operator delete(void *p) U_NOEXCEPT {
if(p!=NULL) {
uprv_free(p);
}
}
-void * U_EXPORT2 UMemory::operator new[](size_t size) U_NO_THROW {
+void * U_EXPORT2 UMemory::operator new[](size_t size) U_NOEXCEPT {
return uprv_malloc(size);
}
-void U_EXPORT2 UMemory::operator delete[](void *p) U_NO_THROW {
+void U_EXPORT2 UMemory::operator delete[](void *p) U_NOEXCEPT {
if(p!=NULL) {
uprv_free(p);
}
}
#if U_HAVE_DEBUG_LOCATION_NEW
-void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NO_THROW {
+void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NOEXCEPT {
return UMemory::operator new(size);
}
-void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NO_THROW {
+void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NOEXCEPT {
UMemory::operator delete(p);
}
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
class U_COMMON_API StackUResourceBundle {
public:
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NO_THROW = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
#endif
StackUResourceBundle();
// to be destroyed before status goes out of scope. Easiest thing is to
// allocate us on the stack in the same (or narrower) scope as status has.
// This attempts to encourage that by blocking heap allocation.
- static void* U_EXPORT2 operator new(size_t) U_NO_THROW = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NO_THROW = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
#endif
public: