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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

You (probably) don't need to learn C

47 点作者 nalgeon超过 1 年前

25 条评论

braza超过 1 年前
&gt; C can teach you useful things, like how memory is a huge array of bytes, but you can also learn that without writing C programs. People say, C teaches you about memory allocation. Yes it does, but you can learn what that means as a concept without learning a programming language.<p>The problem with those takes is that it always come from the people that already know it and had a lot of baggage that distorts it’s view that no one else should learn.<p>Due to several reasons I always worked with high level languages and last year I started to learn C and C++ and how beautiful was to know exactly how are you allocating resources in your application that I felt quite good programming mentally and intellectually.<p>When you come from a world of resource overprovisioning (CPU, memory) when you start to get your head about those languages that puts performance first, you feel good about it in the first moment but in the second after you feel that your whole experience was subpar due to lack of a thought process.
评论 #39118439 未加载
评论 #39118232 未加载
评论 #39118487 未加载
评论 #39119084 未加载
whateveracct超过 1 年前
I&#x27;m confused as to why it&#x27;s such a big deal to learn C. It&#x27;s not a very large or complex language. If you already know how to program, there isn&#x27;t that much to learn to understand C (pointers aren&#x27;t complex).<p>It&#x27;s also a fine beginner language, especially in a structured university setting imo.<p>Yes, you probably don&#x27;t <i>need</i> to learn it. But it can come in handy. For instance, there&#x27;s a wealth of useful software out there in C. It&#x27;s nice to be able to read its source, hack on it, or leverage it from your higher-level language via FFI.
评论 #39118293 未加载
评论 #39118216 未加载
评论 #39135493 未加载
评论 #39118377 未加载
评论 #39118843 未加载
评论 #39118332 未加载
评论 #39122102 未加载
vkazanov超过 1 年前
C might not be strictly necessary as a language one would write in.<p>But all of those problems that C++, Rust or Zig solve - these all are discussed in terms of C. Toolchains, OSes, concepts of static and dynamic linkage are all defined in terms of whatever few abstractions C provides.<p>And sometimes all you have is a good old C compiler. Because C is everywhere.<p>It is not necessary to know the language but it sure is useful to see beneath and beyond.
评论 #39118257 未加载
评论 #39118295 未加载
verall超过 1 年前
I always think that these &quot;C is a high level language &#x2F; virtual machine and it doesn&#x27;t teach you how your computer works because your computer isn&#x27;t a PDP-11&quot; style takes are very silly.<p>C is a high level language that maps very straightforwardly to what the hardware does and programming on a microcontroller without an OS let&#x27;s you eliminate a ton of abstractions that otherwise take years to comprehend.<p>If someone wants to understand what&#x27;s going on &quot;behind the scenes&quot; then it&#x27;s going to be very useful for the to know C before trying to learn how the Cpython interpretor or JVM work.
mattbee超过 1 年前
The tone of this article is a bit combative and incurious for my taste.<p>If you want to understand &quot;how a computer works&quot; - well sure C has gone from low-level to a high-level language. But the model of &quot;how a computer works&quot; - from Python or Ruby or JavaScript - that&#x27;s very often expressed in C: kernels and libraries, in multiple layers. There&#x27;s so much rich information in C code bases on why something behaves like it does. Whole histories of computing are expressed in C - types and APIs that tell you why something might work on one computer and not on another.<p>So sure, don&#x27;t learn C if you don&#x27;t need to, but it&#x27;s not hard to understand if you&#x27;re motivated. And it really does expose you to how a computer works in ways you won&#x27;t find in higher-level languages.
hashtag-til超过 1 年前
Personal PoV: I think it is important to learn the C abstraction because lots of senior people in the industry talk in that abstraction level and if you&#x27;re not able to communicate on that level, it may be a communication hurdle for you.<p>Lots of people certainly can survive without knowing any C, I&#x27;m just saying that it is not an irrelevant thing and if you have the time to invest in learning a bit more than the basics, it is not a waste of time.
评论 #39118172 未加载
samsquire超过 1 年前
I really enjoy C programming. I am a beginner. I wrote a JIT compiler in C recently. Why didn&#x27;t I write it in Rust?<p>The semantics of C really fit how what I think about what computers do: that we move around things between boxes of memory and between registers. That computers is largely logistics between &quot;places&quot;. Edit: It&#x27;s a bit like a factory as in factorio<p>I didn&#x27;t write it in Rust because I find the semantics of C++, Rust, Haskell and other functional languages to be much more abstract and harder than this simple idea of stateful movement.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;samsquire&#x2F;compiler">https:&#x2F;&#x2F;github.com&#x2F;samsquire&#x2F;compiler</a>
agentultra超过 1 年前
If your goal is to learn about how program execution works or memory and other low-level things I suspect learning how to build a compiler targeting a VM (and building the VM) is a good way to learn these things. You&#x27;ll end up learning how to emit VM instructions to store data and the address of the program counter, jump to the function code, then jump back and unpack all that data, etc. You&#x27;ll learn how to implement those VM instructions for a target hardware platform. You&#x27;ll learn how difficult it is to design a good instruction set that covers the platforms you want to support.<p>The nand2tetris course is a pretty good one; you&#x27;ll design the hardware itself in the first part and in the second you&#x27;ll build a compiler&#x2F;VM&#x2F;etc for it.<p>And then you&#x27;ll gain an appreciation for how C works and why it&#x27;s useful.<p>And also why higher-level languages are useful.<p>I don&#x27;t think you need to learn C any more than you need to learn separation logic or category theory though.<p><i>Update</i> The problem with &quot;learning C&quot; is that it has a ton of warts and you might injure yourself in the effort to master it. The language is coupled tightly to libc, the specification is small as far as modern ISO standards go but it still leaves a lot to the imagination (and the implementors). It&#x27;s really quite a complex language to learn <i>well</i> due to all of the sharp edges.<p>And of course, C isn&#x27;t the royal road. There are lots of other models for thinking about programs that aren&#x27;t based on imperative procedures. It&#x27;s just a language.<p>If you want to think about programming and PLT... there are a lot more sophisticated tools.
drewdevault超过 1 年前
You should learn C because everything around you is based on C, most of it open source, and the ability to read and study the massive amount of C code that everything else relies on is a smart bet for understanding computers in a broader sense, and for better bending them to your will.
评论 #39118415 未加载
deaddodo超过 1 年前
I think this statement was long ago amended to:<p>&quot;you should learn a systems language, if you want to be a &#x27;complete&#x27;&#x2F;&#x27;well-rounded&#x27; SWE&quot;<p>C was never the point (it was just the common low level language), the point was that just learning PHP&#x2F;Python&#x2F;JavaScript&#x2F;Ruby wasn&#x27;t enough to get a full grasp of everything that&#x27;s going on, since they hide a lot of the warts from you.<p>I, personally, still believe this. That being said, you can definitely make a career out of doing nothing but JavaScript&#x2F;TypeScript&#x2F;React, PHP&#x2F;Laravel, RoR, etc.
评论 #39118023 未加载
skitter超过 1 年前
&gt; C can teach you useful things, like how memory is a huge array of bytes<p>Careful: In C, memory isn&#x27;t a huge array of bytes.
评论 #39118012 未加载
评论 #39118170 未加载
评论 #39118883 未加载
评论 #39117996 未加载
评论 #39117997 未加载
评论 #39117988 未加载
rollcat超过 1 年前
I think it&#x27;s helpful to learn a little bit of C, to understand why computers work at all, and how we can get, step by step, from bits and bytes to higher-level &quot;things&quot;.<p>Long ago, a friend of mine - a brilliant developer, who nevertheless never dug any lower than basic C++, once tried to write a simple C program that printed out some text. His first attempt went something like:<p><pre><code> void greet(char *name) { char *text = &quot;Hello, &quot;; text += name; text += &quot;\n&quot;; printf(text); } </code></pre> It was a lot of fun going together over his program, and exploring why things didn&#x27;t work the way he expected!
suzumer超过 1 年前
I would argue everyone should learn c purely from a linux&#x2F;free software point of view. So many open source libraries are written in c, and getting as many eyes as possible on that source code would definitely be beneficial.
phamilton超过 1 年前
There&#x27;s also a difference between reading K&amp;R and being comfortable with conventional C. Reading through source code from a mature project like PostgreSQL or the Linux kernel is very different from just knowing how malloc and free work.<p>Being able to follow along in the PostgreSQL source code has been helpful when we see production behavior we don&#x27;t expect.
andjd超过 1 年前
Serious question:<p>The article points out that:<p>`C is far removed from modern computer architectures: there have been 50 years of innovation since it was created in the 1970’s.`<p>Is there a C-like language that uses abstractions based on current ARM or x86 processors? i.e. something above assembly that learning would help us understand how these modern processors actually work?
评论 #39118612 未加载
chasil超过 1 年前
One reason to learn C is to grasp the basic syntax and control structures that it shares with many languages in the same family.<p>For me, awk, PHP and JavaScript come to mind, but the list is rather long:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_C-family_programming_languages" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_C-family_programming_l...</a><p>The 40 pages of Chapter 2 in <i>The AWK Programming Language</i> (first edition) is a superb introduction to the syntax and control structures in this family.<p><a href="https:&#x2F;&#x2F;archive.org&#x2F;download&#x2F;pdfy-MgN0H1joIoDVoIC7&#x2F;The_AWK_Programming_Language.pdf" rel="nofollow">https:&#x2F;&#x2F;archive.org&#x2F;download&#x2F;pdfy-MgN0H1joIoDVoIC7&#x2F;The_AWK_P...</a><p>Other reasons to use C are speed, control, and systems programming.
评论 #39118071 未加载
super_mario超过 1 年前
You probably don&#x27;t need to learn C and program in it, but I do think knowing material covered in say [1] Computer Systems - A Programmer&#x27;s Perspective will make you a better engineer, and historically computer systems were implemented in C and that heritage is still with us. So, being able to read C at least is a prerequisite to understand some of it.<p>[1] - <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Computer-Systems-Programmers-Perspective-Edition&#x2F;dp&#x2F;013409266X" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Computer-Systems-Programmers-Perspect...</a>
merolish超过 1 年前
&gt; Pipelining, cache misses, branch prediction, multiple cores, even virtual memory are all completely invisible to C programs.<p>Are there languages where these are visible? Any time I&#x27;ve seen them discussed it&#x27;s been in terms of writing C&#x2F;C++&#x2F;Java that understand how they work, e.g., the disruptor pattern padding variables to a 64-byte cache line.<p>&gt; C teaches you an abstraction of computers based on the PDP-11.<p>Hmm, I&#x27;d wonder how a C designed today would look based on modern architectures.
评论 #39118770 未加载
评论 #39123911 未加载
photochemsyn超过 1 年前
Learning some C - especially how pointers work with memory, and the often challenging memory addressing operators (&amp;, *, [], ., -&gt;) - is very useful, even if the end result is a strong desire to only use languages that abstract all that away. Otherwise it&#x27;s very easy to get confused over, say, the difference between &#x27;pass by value&#x27; and &#x27;pass by reference&#x27; in JavaScript, or the fairly complicated approach Python uses, &#x27;pass by assignment&#x27;:<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@devyjoneslocker&#x2F;understanding-pythons-pass-by-assignment-in-the-backdrop-of-pass-by-value-vs-9f5cc602f943" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@devyjoneslocker&#x2F;understanding-pythons-pa...</a><p>It&#x27;s also not a bad idea to learn the correct way to open and read a file into memory using C (a page of code at least, with lots of NULL checks and malloc and free), just to appreciate how much work something like Python (a few lines of code) is doing for you under the hood.
gumby超过 1 年前
Those justifications or &quot;reasons&quot; for learning fascinate me. C imagines a PDP-11-like abstract machine, and for reasons good and bad modern processor designers try to make that abstract machine fast.<p>But if you want to get a feel for what the hardware might be doing, as the author says, C is not a good choice, and never really was. If you want to start to understand the hardware, write some assembly code. It&#x27;s not that hard, but you have to think about the actual hardware model.<p>The author&#x27;s other point is also correct (much as it irks me -- I want to know <i>everything</i>): nobody understands the whole vertical stack from quantum mechanics to the latest frameworks, much less its horizontal ramifications (subtleties of TCP implementation or category theory). I could creditably* describe perhaps 60% of how a car works these days but I can no longer do more than simple maintenance. Infuriating, yet surely a good thing.<p>* creditable, sure, but credibly? Not for me to decide.
评论 #39118378 未加载
_xerces_超过 1 年前
My work is in (embedded systems and reverse engineering) so I use C every day as a necessity and love it. For me it is the perfect level of abstraction, not too high and not too low.<p>I use Python for glue code and for running unit tests and other boring stuff and find it frustrating with too many ways of doing things, too many libraries for achieving the same thing.<p>It could be I am still bitter because Python3 broke a bunch of my scripts by forcing everything to be a byte array.
camgunz超过 1 年前
I love C but, this is empirically obvious right? Most software engineers don&#x27;t know C, things are going OK, QED.
评论 #39118367 未加载
richrichie超过 1 年前
It is obvious that don’t <i>need</i> to learn C. Need as in strictly speaking sense.<p>PS You dont need to attend school or university. But I bet nearly every parent tells their kids to attend and graduate with good grades.
seba_dos1超过 1 年前
You (probably) don&#x27;t need to learn <i>any</i> programming language.
User23超过 1 年前
Is the author proficient in C?
评论 #39121907 未加载
评论 #39118554 未加载