HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
eyalroz
printf
C2022–2026
eyalroz / printf

printf

Tiny, fast(ish), self-contained, fully loaded printf, sprinf etc. implementation; particularly useful in embedded systems.

3Distinct people
11Mentions
0Explicit recommenders
650GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Tiny, fast(ish), self-contained, fully loaded printf, sprinf etc. implementation; particularly useful in embedded systems.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2022-09-17 18:39:26 UTC to 2026-06-03 19:57:07 UTC.

02462022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20242025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC606
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

What Hacker News says

11 sources
I'm the maintainer of a standalone printf library, targeting mostly embedded devices and other no-standard-library use cases: https://github.com/eyalroz/printf/ I would like to make sure the library can be used on this SoC, and other RISC-V systems; which it probably can, but if there are any issues cross-compiling for it, or using the toolchain Espressif provides, please consider filing a bug report on GitHub at the link above. Same of course goes for any FOSS librar/tool that you're trying out. Let's help foster a rich(er) ecosystem of software available on these babies!
In ESP32-S31
A popular standalone printf-family library in the embedded world is, well, printf : https://github.com/eyalroz/printf which is independent of a C standard library (it doesn't actually do any I/O itself). Originally by Marco Paland, now maintained, or 'curated' by myself (so, this is a bit of a self-plug, even though I can barely claim authorship). It offers this generalization : int fctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, ...); int vfctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, va_list arg); The library is not performance-oriented, but rather small-code-size-oriented. The family of functions therefore all have a single backing implementation. You might think that implementation must use the function generalization quoted above, but actually it uses a
Read the rest
gadget with some more functionality: typedef struct { void (*function)(char c, void* extra_arg); void* extra_function_arg; char* buffer; printf_size_t pos; printf_size_t max_chars; } output_gadget_t;
In Generalizing Printf in C
Maybe the rabbit hole is much deeper than it seems. Is it really possible to reconcile "no bloat" with "fully standard compliant"? Maybe have a look at https://github.com/eyalroz/printf, if only for the test suite, which looks pretty comprehensive and still fails. Maybe "key features" does not mean the same in all projects, making every project appear "unnecessarily bloated while missing key features" in every other context?
In Show HN: Uprintf a universal stb-style printf implementation for C (no OS)
> Is it? Could you elaborate/provide links to examples of this? https://github.com/FRRouting/frr/tree/master/lib/printf Disclaimer: my work. Customised to support %pHX, %pI4, %pFX, etc. - docs at https://docs.frrouting.org/projects/dev-guide/en/latest/logg... for what these do. > What customization would it support? I don't understand your question. It's reasonably readable and understandable source code. You edit the source code. That's the customisation? > Say, compared to these options: https://github.com/eyalroz/printf?tab=readme-ov-file#cmake-o... First, it is customary etiquette to indicate when linking your own code/work. Second, that is not a POSIX compatible printf, it lacks support for '%n$' (which is used primarily for localisation). Arguably can make sense to omit for tiny embedded platforms - but then why is there FP support?
Read the rest
Third, cmake and build options really seem to be overkill for something like this. Copy the code into the target project, edit it. If you use your own printf, you probably need a bunch of other custom stuff anyway. Fourth, the output callback is a reasonable idea, but somewhat self-contradictory. You're bringing in your own printf. Just adapt it to your own I/O backend, like libc has FILE*.
In Bare metal printf – C standard library without OS
While "newlib" is an interesting idea - the approach taken here is, in many cases, the wrong one. You see, actually, the printf() family of functions don't actually require _any_ metal, bare or otherwise, beyond the ability to print individual characters. For this reason, a popular approach for the case of not having a full-fledged standard library is to have a fully cross-platform implementation of the family which "exposes" a symbol dependency on a character printing function, e.g.: void putchar_(char c); and variants of the printf functions which take the character-printing function as a runtime parameter: int fctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, ...); int vfctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, va_list arg); this is the approach take
Read the rest
n in the standalone printf implementation I maintain, originally by Marco Paland: https://github.com/eyalroz/printf
In Bare metal printf – C standard library without OS
> with file specific flags But you don't want to disable warnings throughout the file, just locally. > Then you don't have non-portable cruft littering the code, You can make it perfectly portable, with a little macro work. See, ,for example: https://github.com/eyalroz/printf/blob/013db1e345cbb166a7eb7... (this is from the standalone-no-libc-printf-family-implementation I maintain; the library is C, the test suite is C++ but it doesn't matter for the purposes of my point here.) and that you only need to do once in your project (you can make it your own header). Even when it comes to use - you can place your warning-disabling within another macro, so that you end up only using a simple single macro for your actual code.
In Detecting if an expression is constant in C
> It uses a few mb of contiguous shared memory and periodically calling a function from a host thread. Well, if someone wants to shoot themselves in the head, then by all means... > Unless you only want sprintf or similar in which case neither is needed. > ... Generally you don't want libc calls in numerical kernels doing useful > stuff - the most common request was for printf as a debugging crutch I have actually adapted a library for that particular case: https://github.com/eyalroz/printf/ I started with a standalone printf-family implementation targetting embedded devices, and (among other things) adapted it for use also with CUDA. > I mostly wanted mmap. Does it really make sense to make a gazillion mmap calls from the threads of your GPU kernel? I mean, is it really not always better to mmap on the CPU side? At most, I might do it a
Read the rest
synchronously using a CUDA callback or some other mechanism. But I will admit I've not had that use-case.
In Using Libc for GPUs
It's only been a few years since I've come to feel I can rely on C compilers all supporting C99, for a library I'm maintaing [1]. And after a couple of years, sure enough - I get an issue opened asking for C89 compatibility because of some arcane embedded toolchain or what-not. So, C23? ... that's nice and all, but, let's talk about it in 20 years or so T_T [1]: https://github.com/eyalroz/printf
In The C23 edition of Modern C
From my experience, maintaining a standalone/embedded printf library - MISRA is a combination of two things: Common-sense rules, and pain-in-the-ass rules. The former are not very interesting and you probably have them in your head as coding guidelines anyway; but the latter, well, are a pain. Example: Avoiding implementation-defined types like `int` _every_where, even in places where my code doesn't care about what sizeof(int) is; or when I want to store the result of a system call which returns an int. I was able to accommodate most (?) of the MISRA rules (https://github.com/eyalroz/printf/issues/77), but mine is just a small library, so I don't know how restrictive they would be for a larger codebase. I suspect it would be painful and force you to avoid some legitimate and useful coding patterns.
In MISRA C

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.