new(3)
β¨ new(3) β the C++ new header, explained by your chaos-bestie β¨
ok so this is the <new> header page from the C++ standard library, and honestly? it's lowkey the most main-character header there is, because it's literally about memory allocation π
(the manual itself is new(3), Library Functions Manual, and yes bestie we're gonna read all of it together, no skimming, i'm watching you π)
Everything below is exactly what's in the page β every signature, every line number, every last throw (). Nothing skipped, nothing invented. periodt.
πΈ NAME πΈ
new β
(she's literally just "new" bestie, the original page gives us no one-liner here, so we're not making one up π)
π SYNOPSIS π
π Classes
class std::bad_allocβ the exception that might get thrown bynew. that's her whole job.
bad_alloc (or any class derived from it) is what gets used to report allocation errors from the throwing forms of new. "
(that stray little " at the end is in the original, i'm not touching it, she's an icon π)
π¦ Namespaces
namespace stdβ yep, she lives instd. home sweet home.
π§ Typedefs
typedef void(* std::new_handler )()β the function-pointer type for the new-handler situation.
β Functions
new_handler std::set_new_handler (new_handler) throw ()
and then the operators, all of them, here we go:
void operator delete (void *, void *) throw ()
void operator delete (void *, const std::nothrow_t &) throw ()
void operator delete (void *) throw ()
void operator delete[] (void *, void *) throw ()
void operator delete[] (void *, const std::nothrow_t &) throw ()
void operator delete[] (void *) throw ()
void * operator new (std::size_t, void *__p) throw ()
void * operator new (std::size_t, const std::nothrow_t &) throw ()
void * operator new (std::size_t) throw (std::bad_alloc)
void * operator new[] (std::size_t, void *__p) throw ()
void * operator new[] (std::size_t, const std::nothrow_t &) throw
()
void * operator new[] (std::size_t) throw (std::bad_alloc)
π Variables
const nothrow_t std::nothrowβ the actualnothrowobject. iconic.
π Detailed Description π
ok so, straight up: this is a Standard C++ Library header.
The header new defines several functions to manage dynamic memory and to handle memory allocation errors π β the page points you at http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 if you want more.
Definition in file new.
π Function Documentation π
heads up bestie: most of these say the exact same thing about replaceable signatures. yes, all twelve of them. yes, i'm including all twelve. that's the assignment π«Ά
π₯ void operator delete (void *, void *) throw () [inline]
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
Definition at line 105 of file new.
π₯ void operator delete (void *, const std::nothrow_t &) throw ()
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π₯ void operator delete (void *) throw ()
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π¦ void operator delete[] (void *, void *) throw () [inline]
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
Definition at line 106 of file new.
π¦ void operator delete[] (void *, const std::nothrow_t &) throw ()
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π¦ void operator delete[] (void *) throw ()
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π§ void* operator new (std::size_t, void * __p) throw () [inline]
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
Definition at line 101 of file new.
π§ void* operator new (std::size_t, const std::nothrow_t &) throw ()
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
β void* operator new (std::size_t) throw (std::bad_alloc)
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π void* operator new[] (std::size_t, void * __p) throw () [inline]
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
Definition at line 102 of file new.
π void* operator new[] (std::size_t, const std::nothrow_t &) throw ()
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π void* operator new[] (std::size_t) throw (std::bad_alloc)
These are the replaceable signatures:
- normal single
newanddelete(no arguments, they throwbad_allocon error) - normal array
newanddelete(same deal) - nothrow single
newanddelete(they take a nothrow argument, and they returnNULLon error) - nothrow array
newanddelete(same)
The placement new and delete signatures (the ones that take a memory address argument and literally do nothing) may not be replaced by a user's program. π«
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. (the robots wrote it, not a human, so if the vibes are a little repetitive... now you know why π)
ok that's the whole page, you ate that π
one last thing β the footer info for the record: this is libstdc++, dated 21 Apr 2009, page new(3). go forth and allocate responsibly bestie π«Άβ¨π
π¦ where this page comes from
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms