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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

To become a good C programmer (2011)

272 点作者 __john大约 9 年前

15 条评论

simplicio大约 9 年前
I found that, after learning the basics of the language via K&amp;R or a similar book, the best way to get a good understanding of C and its weird corner cases and eccentricities is just to go through the comp.lang.c FAQ page. <a href="http:&#x2F;&#x2F;c-faq.com&#x2F;index.html" rel="nofollow">http:&#x2F;&#x2F;c-faq.com&#x2F;index.html</a><p>It&#x27;s pretty comprehensive, and I found the level was pretty good for a &quot;not total newbie, but still not familiar with the subtilties&quot; level that can be kind of hard to find resources for.
评论 #11607174 未加载
评论 #11607178 未加载
joshumax大约 9 年前
When I first started out with C (and back at that time it was the first programmimg language I started learning) I read a majority of the &quot;standard&quot; books and felt rather confident in my understanding of the basics, but when it came to actually <i>writing</i> C, I never felt like I was writing good, pragmatic code. So I started combing through the sources of popular FOSS software like gtk, musl libc, Linux, OpenRC, gcc, etc, submitting bugfixes for a few of them, and asking for code reviews on mailing lists until I finally thought that I was doing okay. I still felt like my knowledge was lacking though, so I decided to learn the internals of the modern x86 machine by writing a hobby OS resembling MINIX (I think I even got X working at one point). Despite still not being the best programmer, it really helped with my understanding of why things are done in C like they are.
评论 #11619300 未加载
optforfon大约 9 年前
The more I learn C the more I hate it. At first it seems simple and easy but reading &quot;Expert C Programming&quot; is reading a laundry list of what&#x27;s really messed up with the language. 80% of the problems would be solved by some sane syntactic sugar that compiles down to C
评论 #11607196 未加载
评论 #11607258 未加载
评论 #11611933 未加载
评论 #11610531 未加载
评论 #11607164 未加载
autarch大约 9 年前
I cannot recommend Understanding and Using C Pointers by Richard Reese highly enough (<a href="http:&#x2F;&#x2F;www.amazon.com&#x2F;Understanding-Using-Pointers-Richard-Reese&#x2F;dp&#x2F;1449344186" rel="nofollow">http:&#x2F;&#x2F;www.amazon.com&#x2F;Understanding-Using-Pointers-Richard-R...</a>)<p>Learning C syntax is pretty easy. Learning to use the standard library is mostly a matter of reading man pages and other people&#x27;s code. But I found understanding pointers and memory management completely opaque until I read that book. It definitely brought me from &quot;beginning C hacker flailing about&quot; to &quot;intermediate C hacker flailing about in a more dangerous way&quot;.
halayli大约 9 年前
You can be an excellent C programmer but still create horrible abstractions. Programmers underestimate the art that goes into that.
scarmig大约 9 年前
K&amp;R is often recommended, and it&#x27;s certainly fun to read and accessible. But I&#x27;ve also heard it&#x27;s outdated, and doesn&#x27;t rally focus much on modern C software design, mostly because the world knew little about it when K&amp;R was written.<p>Thoughts?
评论 #11607207 未加载
评论 #11606806 未加载
评论 #11606798 未加载
评论 #11606695 未加载
评论 #11606689 未加载
评论 #11606852 未加载
评论 #11606733 未加载
dsfuoi大约 9 年前
This is the first time I have seen sizeof used like this:<p><pre><code> sizeof( &amp;array[0] ) </code></pre> This looks equal to:<p><pre><code> sizeof( array ) </code></pre> at first glance, which would give the size of the entire array in bytes, but of course the &amp;array[0] expression is really:<p><pre><code> &amp;*( array + 0 ) </code></pre> which simplifies to:<p><pre><code> array + 0 </code></pre> which is a pointer. And using sizeof on it gives the size of a pointer to int.<p>Edit: (&amp;* array) will also give a pointer.<p>---<p>This is just a really convoluted way to write 2:<p><pre><code> &amp;array[2] - &amp;array[0] &amp;*(array+2) - &amp;*(array+0) (array+2) - (array+0) 2 - 0 </code></pre> Again I have never seen this written in such fashion.
评论 #11606761 未加载
评论 #11606758 未加载
vshan大约 9 年前
Lots of good book suggestions in the Ask HN thread I had posted earlier: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11560509" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11560509</a>
genop大约 9 年前
&quot;And no good book is as good as disassembly output.&quot;<p>[x] Strongly agree [ ] Agree [ ] Neutral [ ] Disagree [ ] Strongly disagree<p>For me, C, i.e., GCC, is most useful as a faster way to generate assembly for a particular CPU than typing it out from scratch. I use GCC as a code generator. I&#x27;d like to see more free asm code generators, but I am not holding my breath.<p>I do appreciate C as a medium for distributing reasonably efficient software.
评论 #11607135 未加载
icdxpresso大约 9 年前
I&#x27;m interested in learning about reverse engineering and malware analysis. Is learning C the proper first step in getting my hands dirty? I used C++ in a few college courses, but I&#x27;ve been primarily a Java developer for the past two years.
评论 #11612090 未加载
onetimePete大约 9 年前
the biggest virtue of a c-programmer is temporary forgetfulness.<p>forget for the moment, that all of the old-guard-tech foundations is basically a castle made of glued together jello filled rubber ducky&#x27;s. forget all the tricks needed to jump through that final hoop in assembly. forget even those hopeful endeavors of the languagewiser that stood up, and then came back because performance is a bitch and there use cases to edgy. forget all those library&#x27;s that overpRomised, undereallocated and disspointered. forget all the futile attempts to steer this boat, carried on the hands of the likes of you, towards some sail-able waters. blissful unawareness settles in, while every &quot;good c-programmer&quot; near you starts to spit fire as soon as management declares a new megalomaniac project in C worthy the effort and thus starting. forget that strange feeling of elated Shame of being the best to repair the most broken car in town.<p>Then, and only then, you will be a &quot;good&quot; C-Programmer, one that knows all the tricks of trade, while not getting wiser.
javajosh大约 9 年前
Very cool. I would like to see a similar recommendation for TCP&#x2F;IP, DNS, and perhaps HTTP 1&#x2F;2, including SSL. (Although I suppose you could start with C and then just get involved with the linux kernel, linux net utils, and nginx. But that&#x27;s like, hardcore.)
评论 #11609054 未加载
jsnk大约 9 年前
What&#x27;s a good practical but small enough project you can do with C? Typically if you are learning Ruby or Node, people recommend creating a blog. What&#x27;s something like that for C?
评论 #11607458 未加载
评论 #11607416 未加载
评论 #11607544 未加载
评论 #11607639 未加载
评论 #11621717 未加载
评论 #11607169 未加载
评论 #11609026 未加载
agumonkey大约 9 年前
What other experiences, non C based, will make you a better C programmer too ? ADA, ML, Forth ? some other academic domain ?
kyled大约 9 年前
Learn assembly then c will be easy