展示HN:Uprintf,一个通用的stb风格的C语言printf实现(无操作系统)

1作者: Forgret7 天前原帖
我对缺乏真正可移植且无依赖的 printf 函数在嵌入式和内核开发中的应用感到沮丧。大多数解决方案要么过于臃肿,要么缺少关键功能。 因此,我创建了 Uprintf。它是一个单头文件库,提供完整的 printf 功能(包括标志、宽度、精度、浮点数,甚至自定义格式说明符),适用于从裸机到桌面的开发,且没有任何依赖或复杂的条件编译。 主要特点: · 仅一个头文件,无依赖,无动态分配 · 完整的标准支持:%d、%x、%f、%.*s 等 · 可扩展,支持自定义格式处理器(为您的项目添加 %T) · 可配置:禁用浮点数,设置区域等 · MIT 许可证 GitHub: [https://github.com/Ferki-git-creator/Uprintf](https://github.com/Ferki-git-creator/Uprintf) 我期待您的反馈和贡献!
查看原文
I&#x27;ve been frustrated by the lack of a truly portable, no-dependency printf for embedded and kernel development. Most solutions are either too bloated or missing key features. So I built Uprintf. It&#x27;s a single-header library that gives you full printf (flags, width, precision, floats, even custom specifiers) from bare metal to desktop, with zero dependencies or #ifdef hell. Key features: · One header file, no dependencies, no dynamic allocation · Full standard support: %d, %x, %f, %.*s, etc. · Extensible with custom format handlers (add %T for your project) · Configurable: disable floats, set locale, etc. · MIT Licensed. GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;Ferki-git-creator&#x2F;Uprintf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Ferki-git-creator&#x2F;Uprintf</a> I&#x27;d love your feedback and contributions!