[libc-commits] [PATCH] D147008: [libc][bazel] add file printf targets and support
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Apr 24 15:19:25 PDT 2023
michaelrj added inline comments.
================
Comment at: libc/src/__support/CPP/cstring.h:18
+// a return value for a function that in C would return a char* and a flag for
+// if that char* needs to be freed.
+class CString {
----------------
sivachandra wrote:
> Is this comment correct?
I think so. This class is primarily useful as a read-only string that may be dynamically allocated, but will automatically clean itself up. The primary use for that is as a return value.
================
Comment at: libc/src/__support/CPP/cstring.h:31
+ str = in_str;
+ cstr = str.c_str();
+ }
----------------
sivachandra wrote:
> Whats the idea behind keeping a `cstr` member?
the `cstr` member is used below in the `const char*` initializer. It allows this to hold either a `cpp::string` or a `const char*`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147008/new/
https://reviews.llvm.org/D147008
More information about the libc-commits
mailing list