[libc-commits] [PATCH] D141091: [libc] add scanf float converter
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Jan 6 15:05:16 PST 2023
michaelrj added inline comments.
================
Comment at: libc/src/stdio/scanf_core/float_converter.cpp:25
+
+class VectorString {
+ static constexpr size_t INIT_BUFF_SIZE = 64;
----------------
sivachandra wrote:
> Isn't this an equivalent of `std::string`? If yes, may be you should move it to CPP and name it `cpp::string`.
I've separated adding the string class into a separate patch, but I'll talk more about my thought process here:
I've kept the name VectorString for a couple reasons, the first being to make it clear that this can allocate. Next, due to it allocating it needs a way to report an error state in case allocation fails. The `std::string` class throws an exception when this happens, but we're not using exceptions so it has to be communicated in a different way. The way I have it currently is that when the `append` function is called to returns a boolean that represents if it has succeeded (as opposed to returning `*this` to allow for chained calls). This is a small but meaningful difference in API that I think is necessary but might confuse users if we used the existing name.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141091/new/
https://reviews.llvm.org/D141091
More information about the libc-commits
mailing list