[libc-commits] [libc] [libc] Support %lc in printf (PR #169983)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Sat Dec 27 10:21:32 PST 2025


================
@@ -20,20 +30,49 @@ namespace printf_core {
 template <WriteMode write_mode>
 LIBC_INLINE int convert_char(Writer<write_mode> *writer,
                              const FormatSection &to_conv) {
-  char c = static_cast<char>(to_conv.conv_val_raw);
 
-  constexpr int STRING_LEN = 1;
+  char buffer[MB_LEN_MAX];
+  cpp::string_view to_write;
----------------
vonosmas wrote:

TBH I would just have `size_t write_size` here, and convert to `string_view` inside Writer invocation, since you're not actually doing anything with `string_view` before:

```
RET_IF_RESULT_NEGATIVE(writer->write({buffer, write_size}));

https://github.com/llvm/llvm-project/pull/169983


More information about the libc-commits mailing list