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_t
and its objectnothrow
are used by programmers ? Is the object really needed to beextern
? - When does
new_handler
used ? - Why all the
operator new/delete
are declared inextern C++
block ?