[libc-commits] [libc] [libc] Return the written character from putc, fputc and putchar (PR #239980)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Sun Nov 8 18:21:28 PST 2026


================
@@ -28,7 +28,8 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) {
     // The stream should be in an error state in this case.
     return EOF;
   }
-  return 0;
+  // C requires the character written, as an unsigned char, not a success code.
----------------
vonosmas wrote:

Please remove the comment, the code is self-explanatory already (here and below).

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


More information about the libc-commits mailing list