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 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 5:05:26 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

6 sources
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

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.