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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Anonymous functions in C

46 点作者 C--将近 11 年前

5 条评论

mtdewcmu将近 11 年前
This is basically a way of obfuscating your C code. If you want to write obfuscated code, C++ has extensive support for this. I think it's actually a strength of C to not have many features. It ultimately makes code more readable and reliable.
评论 #7926179 未加载
评论 #7926433 未加载
overgard将近 11 年前
That's neat, but without closures I don't really see how you could do much with it outside of toy examples. Going off the examples -- how often do you write something like a foreach or a map or reduce that doesn't reference its enclosing scope?
评论 #7926593 未加载
评论 #7926340 未加载
评论 #7926331 未加载
评论 #7926584 未加载
评论 #7926547 未加载
yason将近 11 年前
Anonymous (or inner) functions aren't really valuable per se but syntactic sugar for writing the code into a static function somewhere in the same file: closures give anonymous (or inner) functions the power which is what makes them useful.
misframer将近 11 年前
If you use clang, blocks are another approach.<p>[0] <a href="http://en.wikipedia.org/wiki/Blocks_(C_language_extension)" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Blocks_(C_language_extension)</a><p>[1] <a href="http://clang.llvm.org/docs/BlockLanguageSpec.html" rel="nofollow">http:&#x2F;&#x2F;clang.llvm.org&#x2F;docs&#x2F;BlockLanguageSpec.html</a>
评论 #7926636 未加载
评论 #7926542 未加载
malkia将近 11 年前
Wondering how a debugger would react to this code?
评论 #7926960 未加载