TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lisp macros for C

113 pointsby woobyabout 8 years ago

5 comments

skolosabout 8 years ago
&gt; Why? Because a language without macros is a tool: You write applications with it. A language with macros is building material: You shape it and grow it into your application.<p>Very nice! If only this could work with C++.
veli_jozaabout 8 years ago
This is very interesting way to breathe new life into C. I can already think of few places where powerful macros would come in handy and eliminate some pains. On the other hand, I&#x27;m not sure if I&#x27;d want to read other people&#x27;s low-level code sprinkled with high-level constructs. Perhaps Nim would serve this purpose better?
评论 #14155202 未加载
yorwbaabout 8 years ago
TIL: You can use typeof(expr) as a type in variable declarations. C has type inference! A plain old C macro like<p><pre><code> #define AUTO(var, expr) typeof(expr) var = expr </code></pre> might be handy sometimes.
评论 #14154807 未加载
评论 #14154198 未加载
评论 #14154964 未加载
MrZipfabout 8 years ago
Thanks for sharing. The documentation is well done, looking forward to checking out the code.
pettersabout 8 years ago
This way of adding metaprogramming to C does not improve performance. The compiler will still be unable to inline the comparisons in the qsort example. C++ will continue to be much faster.
评论 #14156241 未加载