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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Adding Modules to C in 10 Lines of Code [pdf]

138 点作者 pmarin将近 3 年前

4 条评论

Shadonototra将近 3 年前
ImportC is shaping up to be one of the greatest feature of D<p>Being able to just import your C code, and call it from C, or when you need to go back to C and resume your work by just importing your D modules<p>I tried it, while it still need some finish, it worked very well! (you had to put your files through a preprocessor though, hopefully this step won&#x27;t be needed in the future)<p>Every modern language should include a C compiler, it is stupid to give up the entire C ecosystem!<p>No wonder Walter&#x27;s name is &quot;Bright&quot;!<p>To the people who still doubt about D &quot;because of the GC&quot;, it doesn&#x27;t exist for me, i am making an online 3D game targeting WASM without it, with all the language features!<p>For cases when you need one &quot;if you use D as a scripting language&quot;, it will be very helpful to have!<p><a href="https:&#x2F;&#x2F;www.kdom.xyz&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.kdom.xyz&#x2F;</a><p>If you love C, but need something modern with more safeties, give D a try!<p>D is a pragmatic language, very powerful, covers everyone&#x27;s needs!<p>If you tried it before, now is the time to give it another try!
评论 #31893801 未加载
评论 #31898287 未加载
评论 #31892541 未加载
评论 #31973966 未加载
评论 #31898298 未加载
评论 #31896232 未加载
评论 #31893455 未加载
评论 #31892626 未加载
unsafecast将近 3 年前
I&#x27;ve done something different before:<p><pre><code> &#x2F;&#x2F; main.c #include &lt;module.c&gt; int main() { moduleFunction(); } &#x2F;&#x2F; module.c #include &lt;stdio.h&gt; void moduleFunction() { printf(&quot;calling modules&quot;); } </code></pre> This has its issues (you can&#x27;t do parallel compilation anymore; you don&#x27;t have unexported functions, etc), but it works fine for small things. Super helpful when I want to make a small thing and don&#x27;t want to bother with headers.<p>You just include all the C files in one file and be done with it.
评论 #31892479 未加载
评论 #31893251 未加载
评论 #31892558 未加载
评论 #31895401 未加载
bachmeier将近 3 年前
On the topic of the presentation, I&#x27;d be happy to have a way to kill the preprocessor. Not that I expect that to happen. Reading C code is like reading literature that only makes sense if you know eight languages, four of which are known to fewer than 100 people.
评论 #31898228 未加载
评论 #31897550 未加载
评论 #31896224 未加载
评论 #31898512 未加载
khoobid_shoma将近 3 年前
The title is a bit misleading. This is about extending C grammar used in D.