[libc-commits] [PATCH] D122773: [libc][NFC] add outline of printf

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Apr 1 11:40:10 PDT 2022

sivachandra added inline comments.

Comment at: libc/src/stdio/printf_files/writer.h:38
+  // written. It always increments chars_written by length.
+  void write(const char *new_string, size_t length);
michaelrj wrote:
> sivachandra wrote:
> > These functions should be implemented inline to avoid multiple indirections?
> Could you clarify what you mean by implementing this inline? This function won't just be calling the raw_write function. If length + chars_written > max_length then the length passed to raw_write will be max_length - chars_written, so that this doesn't overrun the buffer.
This class is essentially a convenience wrapper to call `raw_write`, albeit with some logic before and after potentially. What I mean is that, if make these functions inline, then we avoid unnecessary function call indirections. You don't have to implement them in this patch of course.

  rG LLVM Github Monorepo



More information about the libc-commits mailing list