[PATCH] D41458: [libc++][C++17] Elementary string conversions for integral types

Zhihao Yuan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 3 01:00:26 PDT 2018


lichray marked an inline comment as done.
lichray added inline comments.


================
Comment at: src/charconv.cpp:34
+
+#define APPEND1(i)                              \
+    do                                          \
----------------
lichray wrote:
> mclow.lists wrote:
> > I'd really like to see some numbers here showing how this (somewhat awkward) code performs better than the straightforward versions.
> > 
> > Because maintenance is forever.
> > 
> > Note: I'm sure that this was true on older compilers - but is it true today?
> One thing I could try may be using return values rather than output parameters, like
> ```
> buffer = append3(buffer, b); 
> ```
> But I really don't think doing these makes the code any bit more maintainable comparing to
> ```
> APPEND3(b);
> ```
> , which looks very straightforward and expressive to me...
OK, after several attempts, I figured out that by eliminating side-effects to the `buffer` pointer in the helper functions, Clang now generates code of the same quality, and runs statistically faster.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41458





More information about the cfe-commits mailing list