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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Libpp – functional programming macros for the C preprocessor

3 点作者 majika将近 11 年前

1 comment

majika将近 11 年前
I released Macrofun [0] a few weeks ago, which provides similar macros, but does not conform to standards. A commenter on my submission to &#x2F;r&#x2F;programming [1] pointed out the related `P99_FOR` macro of P99 [2], which handles &quot;variable&quot; number of arguments while conforming to standards.<p>Libpp&#x27;s macros are implemented in a fashion similar to `P99_FOR`, but I think it&#x27;s much cleaner. For example, `P99_FOR`&#x27;s handler macros are defined within a 10,000 line header file [3], and `P00_FOR_50` calls `P00_FOR_49`, so you&#x27;re going to require as many preprocessor evaluations as arguments given. By contrast, `PP_MAP` is defined within a 300-line header file, and `PP_MAP_50` evaluates directly to the desired expression.<p>You can also change the argument limit of Libpp&#x27;s macros to your liking, as detailed in the readme.<p>Libpp isn&#x27;t as powerful or general as P99, but I&#x27;m finding it much easier to use. Perhaps that&#x27;s just because I wrote it, though. Feedback would be really appreciated.<p>[0]: <a href="https://github.com/mcinglis/macrofun" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mcinglis&#x2F;macrofun</a><p>[1]: <a href="https://pay.reddit.com/r/programming/comments/260cb6/macrofun_standardsdefying_functionalprogramming/" rel="nofollow">https:&#x2F;&#x2F;pay.reddit.com&#x2F;r&#x2F;programming&#x2F;comments&#x2F;260cb6&#x2F;macrofu...</a><p>[2]: <a href="http://p99.gforge.inria.fr/p99-html/group__preprocessor__for_gae3eb0e3a5216300874ed6cb9abc170ce.html#gae3eb0e3a5216300874ed6cb9abc170ce" rel="nofollow">http:&#x2F;&#x2F;p99.gforge.inria.fr&#x2F;p99-html&#x2F;group__preprocessor__for...</a><p>[3]: <a href="http://p99.gforge.inria.fr/p99-html/p99__generated_8h_source.html#l08297" rel="nofollow">http:&#x2F;&#x2F;p99.gforge.inria.fr&#x2F;p99-html&#x2F;p99__generated_8h_source...</a><p>I&#x27;ve answered some questions about Libpp on &#x2F;r&#x2F;programming and &#x2F;r&#x2F;c_programming:<p><a href="https://pay.reddit.com/r/programming/comments/27rutk/libpp_standardsconformant_functionalprogramming/" rel="nofollow">https:&#x2F;&#x2F;pay.reddit.com&#x2F;r&#x2F;programming&#x2F;comments&#x2F;27rutk&#x2F;libpp_s...</a><p><a href="https://pay.reddit.com/r/C_Programming/comments/27ru43/libpp_standardsconformant_functionalprogramming/" rel="nofollow">https:&#x2F;&#x2F;pay.reddit.com&#x2F;r&#x2F;C_Programming&#x2F;comments&#x2F;27ru43&#x2F;libpp...</a>