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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 31 13:45:17 PDT 2021


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

Thanks for fixing this! The CI is failing due to something that has been fixed now. Please rebase onto `main` and re-upload your diff, that will run CI again and everything should be green.



================
Comment at: libcxx/include/locale:1466
+                            + ((__iob.flags() & ios_base::showbase) != 0)        // base prefix
+                            + 1;                                                 // terminating null character
     char __nar[__nbuf];
----------------
Mordante wrote:
> Wouldn't it look better to do the rounded up character determination in one step?
> `((numeric_limits<unsigned long>::digits + 2) / 3)`
IMO it's easier to read as-is since the `+ 2` trick isn't immediately obvious (to me at least).


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