[libc-commits] [libc] [libc] Add printf error handling (PR #162876)

Marcell Leleszi via libc-commits libc-commits at lists.llvm.org
Fri Oct 17 08:26:53 PDT 2025


================
@@ -22,6 +22,18 @@
 namespace LIBC_NAMESPACE_DECL {
 namespace printf_core {
 
+struct PrintfResult {
+  size_t value;
+  int error;
+
+  constexpr PrintfResult(size_t val) : value(val), error(0) {}
+  constexpr PrintfResult(size_t val, int error) : value(val), error(error) {}
+
+  constexpr bool has_error() { return error != 0; }
+
+  constexpr operator size_t() { return value; }
+};
----------------
mleleszi wrote:

Good point, done

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


More information about the libc-commits mailing list