[libc-commits] [PATCH] D147375: [libc] Use string_view for write_to_stderr

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Sun Apr 2 05:51:55 PDT 2023


gchatelet added a comment.

In D147375#4238384 <https://reviews.llvm.org/D147375#4238384>, @jhuber6 wrote:

> In D147375#4238363 <https://reviews.llvm.org/D147375#4238363>, @gchatelet wrote:
>
>> In D147375#4238339 <https://reviews.llvm.org/D147375#4238339>, @jhuber6 wrote:
>>
>>> Do we want to stop using `const char *`? We only use this internally currently, but it was easier for me to test when it was a C type. I'll let @sivachandra decide.
>>
>> `cpp::string_view` is implicitly constructible from a `const char*` so the current code still works. Are you calling the function from C code?
>> Relevant discussion for this patch: https://reviews.llvm.org/D147231#inline-1423241
>
> I was just calling it using this function for a standalone test, but it's not a huge deal.

I can keep `the const char*` version in the gpu folder on top of the `string_view` version if that helps.

> Alternatively, we could keep the function interface the same and do the conversion internally.

This wouldn't help for single char or non null-terminated strings.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147375



More information about the libc-commits mailing list