I came across a small standard header file <new>. I have probably not seen its direct use before. Here is the g++ version for those who are interested.
Below part is of my interest:
struct nothrow_t { };
extern const nothrow_t nothrow;
/** If you write your own error handler to be called by @c new, it must
* be of this type. */
typedef void (*new_handler)();
/// Takes a replacement handler as the argument, returns the previous handler.
new_handler set_new_handler(new_handler) throw();
- How
struct nothrow_tand its objectnothroware used by programmers ? Is the object really needed to beextern? - When does
new_handlerused ? - Why all the
operator new/deleteare declared inextern C++block ?