[libc-commits] [PATCH] D139584: [libc] Add custom operator new to handle allocation failures gracefully.

Thorsten via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Dec 7 17:02:54 PST 2022


tschuett added inline comments.


================
Comment at: libc/src/string/allocating_string_utils.h:27
+  AllocChecker ac;
+  char *newstr = new (&ac) char[len];
+  if (!ac)
----------------
lntue wrote:
> Does it mean that our `strdup` will always return aligned strings?
Would in this case a malloc returning a result or error type easier to understand and safer?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139584/new/

https://reviews.llvm.org/D139584



More information about the libc-commits mailing list