new(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

✨ 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 by new. 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 in std. 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 actual nothrow object. 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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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 new and delete (no arguments, they throw bad_alloc on error)
  • normal array new and delete (same deal)
  • nothrow single new and delete (they take a nothrow argument, and they return NULL on error)
  • nothrow array new and delete (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