[libcxx-commits] [PATCH] D103339: [libcxx][NFC] Tidy up calculation of __nbuf in num_put::do_put, and add comments

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 31 09:29:15 PDT 2021


Mordante added a comment.

Nice catch! Can you rebase the patch to rerun the CI?



================
Comment at: libcxx/include/locale:1466
+                            + ((__iob.flags() & ios_base::showbase) != 0)        // base prefix
+                            + 1;                                                 // terminating null character
     char __nar[__nbuf];
----------------
Wouldn't it look better to do the rounded up character determination in one step?
`((numeric_limits<unsigned long>::digits + 2) / 3)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103339



More information about the libcxx-commits mailing list