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.

Lesser-known C coding styles

3 pointsby Kristine1975over 8 years ago

2 comments

adrianratnapalaover 8 years ago
I shan&#x27;t be taking it up, but this semicolon-first style has merits.<p>The example looks perfectly readable to me. And it is probably makes it harder to miss semicolons, because all those for one block line up in a single column. The main thing I fear is it increases the chance of an accidental:<p><pre><code> if(foo) ; do_something_i_though_was_conditional() </code></pre> But if you are already using braces everywhere, {then this isn&#x27;t a problem}.
评论 #12563099 未加载
informatimagoover 8 years ago
I&#x27;m partial to the lisp style:<p>#include &lt;stdio.h&gt;<p>int loop(int i){ return ((i==0) ?0 :(printf(&quot;%d\n&quot;,i),loop(i-1)));}<p>int main (void){ return loop(10);}
评论 #12564240 未加载