TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: A set of dbg() macros for C

3 点作者 eerimoq超过 5 年前

1 comment

s_gourichon超过 5 年前
I wrote and use regularly similar macros for C, oriented towards minimal context.<p>They are less advanced on some areas, but more advanced on some.<p>For example, they do not depend on C11 generic feature, which is an advantage on the many non-C11 platforms (like 8-bit-targeting compiler SDCC).<p>On the strong side:<p>* log any expression: `somemacro(foo.bar())` will log `foo.bar() = 42` * compile-time global enable&#x2F;disable * compile-time debug level threshold<p>I&#x27;ve been planning to share that for a moment.<p>Some working parts are used on <a href="https:&#x2F;&#x2F;github.com&#x2F;cpcitor&#x2F;color-flood-for-amstrad-cpc&#x2F;blob&#x2F;master&#x2F;log.h" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cpcitor&#x2F;color-flood-for-amstrad-cpc&#x2F;blob&#x2F;...</a><p>It will eventually appear on <a href="https:&#x2F;&#x2F;github.com&#x2F;fidergo-stephane-gourichon?tab=repositories" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fidergo-stephane-gourichon?tab=repositori...</a><p>I also wrote similar macros for C++ mentioned on <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=21071367" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=21071367</a>