finds.dev← search

// the find

mpaland/printf

★ 3,014 · C · MIT · updated Apr 2023

Tiny, fast, non-dependent and fully loaded printf implementation for embedded systems. Extensive test suite passing.

A single-file printf/sprintf/snprintf implementation for embedded systems where you can't or won't link against libc. Around 600 lines of C, no dynamic allocation, reentrant by design. The target audience is bare-metal or RTOS developers who need formatted output without dragging in 20k of libc bloat.

Full flag and specifier coverage including %e/%g exponential, width/precision with *, and binary %b — most 'tiny' implementations stop well short of this. Genuinely malloc-free and reentrant: all buffers live on the stack, no static state, safe to call from ISRs or multiple threads without locks. The compiler switches (PRINTF_DISABLE_SUPPORT_FLOAT etc.) let you strip features to hit a specific flash budget rather than accepting one-size-fits-all. Test suite with 400+ cases via Catch2 is unusually thorough for a project at this size.

Project is effectively dead — last commit April 2023, the 2020 'we're not dead' announcement in the README is itself five years old, and there are open PRs and issues with no response. Floating point max precision caps at 9 digits, which is fine for most embedded logging but will silently produce wrong output if you need full double precision. The `sprintf` (unbounded) variant is included and exposed despite the README warning against it — it'll write past your buffer if you hand it to anyone who doesn't read the docs. No `%n` support, which is standard-correct from a security standpoint but worth knowing if you're porting code that uses it.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →