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.

The Curious Case of the Longevity of C

178 pointsby pablobazover 7 years ago

29 comments

hellofunkover 7 years ago
I&#x27;ve always like the description of C as just being &quot;raw memory, but with syntactic sugar.&quot;<p>I think C is still so pervasive for 2 simple reasons (I might be wrong):<p>1) It&#x27;s a small language. Compared to many newer languages (Swift, modern C++, old C++, Objective-C, Java), it&#x27;s quite tiny. The language itself can be learned in short time. (Which is deceptive, because properly using what you have learned takes longer than a short time).<p>2) It&#x27;s fast. It&#x27;s just direct memory access, direct and explicit hardware manipulation. And whether justified or not, there is a very large portion of the developer community that remains obsessed with speed. I see it all the time, even when speed isn&#x27;t not going to matter enough to justify C. I often see people going way out of their way, making their work much more time-consuming, because of their everlasting pursuit of writing the fastest damn program they possibly can.
评论 #15393271 未加载
评论 #15391052 未加载
评论 #15395550 未加载
评论 #15393386 未加载
评论 #15393571 未加载
userbinatorover 7 years ago
<i>Add to this the disastrously central role that C has played in our ongoing computer security nightmare</i><p>One sees plenty of news on the downsides, but on the other hand the lack of security has also enabled console homebrew, iOS jailbreaking, Android rooting, and a bunch of other creatively liberating activities which involve doing something not officially sanctioned. It&#x27;s worth pondering whether we would be better off, had everyone switched to something much &quot;safer&quot; (maybe even with formal verification) a long time ago. I think it&#x27;s debatable.
评论 #15391210 未加载
评论 #15391762 未加载
评论 #15392387 未加载
评论 #15391279 未加载
jwilkover 7 years ago
&gt; <i>We rely on Python which is written in C89, a standard older than many of our developers.</i><p>Python ≥ 3.6 requires (some features of) C99.<p>&gt; <i>Perhaps the reluctance to move to a more ‘modern’ C is that even C99 can’t legally buy a drink</i><p>Perhaps it&#x27;s because MSVC didn&#x27;t fully support anything newer.<p>Source: <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0007&#x2F;#c-dialect" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0007&#x2F;#c-dialect</a>
评论 #15391206 未加载
评论 #15392378 未加载
reacwebover 7 years ago
&quot;C is the desert island language&quot;. see <a href="http:&#x2F;&#x2F;crypto.stanford.edu&#x2F;~blynn&#x2F;c&#x2F;intro.html" rel="nofollow">http:&#x2F;&#x2F;crypto.stanford.edu&#x2F;~blynn&#x2F;c&#x2F;intro.html</a><p>For me, Linux is a huge development environment dedicated to C programming. Chapter 2 and 3 of manual pages gives C api. C gives the most direct access to kernel. IMHO we should try to find a replacement for C and the first target for this language should be linux kernel. If you can conceive a language that Linus Torvalds accepts, the rest of the planet will follow ;-)
评论 #15391351 未加载
评论 #15394053 未加载
dingo_batover 7 years ago
In my mind, C very closely resembles what&#x27;s going on in my mind&#x27;s model of the computer. I &quot;think&quot; in C when I&#x27;m thinking about an algorithm. It&#x27;s almost exactly the same as the fake language people sometimes use for explaining an algorithm. I think this property contributes towards the popularity. No &quot;artificial&quot; abstractions like classes, templates, modules, imports etc. Just think of the first step you would do to solve a problem, and write it. Then think of the next step, and write that. And you get fast, portable code that produces tiny binaries! What more do you need?
评论 #15395532 未加载
simiasover 7 years ago
I think that during the nineties the focus switched from compiled, small runtime, unmanaged language to higher level, garbage collected, &quot;big runtime&quot; languages like Java or the scripting languages. One notable exception being C++ but its complexity and the difficulty to interface it with other languages meant that it couldn&#x27;t completely replace C.<p>So for a long time if you wanted to do low level, fast, small, reasonably portable code you simply didn&#x27;t have much of a choice.<p>Rust is the first language in a long time that I think could end up replacing C in all of its use cases but there&#x27;s still some way to go. The main difficulty I can foresee is that like C++ it&#x27;s significantly more complex than C and harder to interface with other programing languages (you end up making an unsafe C interface).<p>I think C is here to stay. The billions of lines of C code out there won&#x27;t be rewritten in a fortnight.
评论 #15391027 未加载
Santosh83over 7 years ago
C works everywhere, and everyone knows C, or can learn it in a couple of weeks and get coding. This is a hard combination to wholesale replace, but then not even Rust aims to do that. Instead it aims to chip away gradually, and I don&#x27;t see why it can&#x27;t do <i>that</i> .
评论 #15390964 未加载
评论 #15390960 未加载
评论 #15392486 未加载
评论 #15391005 未加载
jdblairover 7 years ago
My 2 cents, from the perspective of someone who built a career on writing software in C for small devices.<p>C has longevity b&#x2F;c its compact and provides a straightforward model of memory on the machine. I understand the desire to use safe, garbage collected, memory safe language when you&#x27;re serving HTTP requests, but sometimes you need to access the hardware: twiddle a GPIO or read from a DMA device. This is where I&#x27;ve yet to see a good replacement for C, and by extension, C++ (b&#x2F;c its fundamentally still just C). Maybe rust is there, but I don&#x27;t have experience there to judge.<p>[edited for clarity]
评论 #15394034 未加载
评论 #15393442 未加载
评论 #15393047 未加载
Animatsover 7 years ago
C was originally a language for modest size programs on machines with 64K address spaces. C isn&#x27;t a bad language for a thousand line program. It&#x27;s a terrible language for a million line program. Just to get memory safety, there&#x27;s too much that has to be manually coordinated across compilation unit boundaries.<p>The three big questions in C are &quot;how big is it?&quot;, &quot;who owns it?&quot;, and &quot;who locks it?&quot; The language gives zero help with all of those issues. Most later languages deal with some or all of those issues.
评论 #15394322 未加载
评论 #15394436 未加载
colechristensenover 7 years ago
I&#x27;m quite bored by the obsession of some for replacing C.<p>Yes, it does exactly what you tell it to do and that&#x27;s dangerous. It was a high level language 25 years ago, but today the metaphor should be assembly. Nobody would criticize assembly for letting you shoot yourself in the foot, C is much the same.<p>The biggest threat to the tech sector is Linus dying and being replaced by some charlatan who insists on replacing C and using Jira.<p>&lt;&#x2F;offtopic&gt;
评论 #15391178 未加载
评论 #15391003 未加载
评论 #15393310 未加载
评论 #15391329 未加载
评论 #15392870 未加载
评论 #15390975 未加载
评论 #15391330 未加载
评论 #15391033 未加载
评论 #15391036 未加载
评论 #15392612 未加载
评论 #15391716 未加载
评论 #15392084 未加载
jstewartmobileover 7 years ago
As maddening as it may be, my gut tells me it has more to do with the precompiler than anything else. When it comes to wrestling with cross-platform differences, I don&#x27;t know of a corresponding feature in Rust or Go that is equally powerful (or equally ugly!).<p>As long as computing remains a battleground where rich assholes put vastly different wrappers around the exact same shit so they can wring more money out of us, I will probably be writing in that abominable assembly language w&#x2F; turing-complete string-paster for many years to come.
评论 #15391336 未加载
jerrreover 7 years ago
&gt;Perhaps now it is time for a new generation to make their mark, will their efforts last 40 years? Rust anyone?<p>I&#x27;d think it&#x27;s quite difficult for a new language to replace a language whose main attractive points are it&#x27;s longevity, stability (not the code and programs coming out of it, but the syntax and tools etc), and broad support.<p>There are many fields where C is easy to beat. But I don&#x27;t think the next 40 year lasting language will be a C replacement.
评论 #15392869 未加载
评论 #15390923 未加载
zevebover 7 years ago
&gt; In 1987 this code took around half an hour to run, today 0.03 seconds. Progress eh?<p>The thing I take away when reading this is that in 1987 there were superior languages to C which — while usable — were just a <i>bit</i> too sluggish, and hence lost out. I&#x27;m thinking specifically of Smalltalk &amp; Lisp, but I&#x27;m sure that there are others (maybe ML was around that far back?).<p>Well, if a program which once ran in half an hour can now run in 300 milliseconds, I think that maybe we should reconsider using just a little of that extra performance to run a better language environment.<p>Imagine if we had OSes written in safe languages which catch errors rather than allowing programs to misbehave. Honestly, it&#x27;s hard for me to do because I&#x27;ve become so accustomed to crashes. Recently I&#x27;ve been doing some X programming with Lisp, and it&#x27;s amazing — even when I make a mistake, things keep on running properly. I just see an error and that&#x27;s that.<p>Well, most of the time, anyway. Nothing&#x27;s perfect. Still, the experience is <i>orders</i> of magnitude better than writing C. I mean that literally, not figuratively.<p>(Also, as an aside: when I switched tabs to the article, it displayed for just a second, then disappeared. Reader mode didn&#x27;t even work. I had to enable JavaScript just to view some text. What gives‽)
评论 #15393083 未加载
raartsover 7 years ago
&gt; Add to this the disastrously central role that C has played in our ongoing computer security nightmare<p>Hindsight is 20&#x2F;20.<p>C was simply the pervasive language when the internet happened. C was designed when the world was a friendlier place, where buffer overflows did not exist. It was embraced by everyone because of its speed and simplicity.<p>No C programmer was raised&#x2F;educated to have security in the front of his mind. Hell, many programmers of any language still don&#x27;t.<p>Stop bashing C and start using Oauth instead of inventing your own authentication schemes.
评论 #15394783 未加载
评论 #15394616 未加载
评论 #15393903 未加载
评论 #15393968 未加载
评论 #15393660 未加载
throwaway2016aover 7 years ago
C was the first language I learned in the mid-90s and I still go back to it once and a while when I want raw speed and direct memory access. I know other languages, sure, but I have yet to find a suitable replacement that lets me do what I want to do on a machine level without getting in the way.<p>Lately I&#x27;ve been doing some of the stuff I would normally do in C in GoLang instead. But it still can&#x27;t match C in performance. (beats the hell out of Node.js though which is where I do most of my middle-tier &#x2F; front-end code)<p>It also makes an excellent foot gun for the same reason.
blubover 7 years ago
If something is to replace C (or C++), I hope it&#x27;s not Rust, because Rust is even more complicated than C++.<p>People should not have to bend their mind to satisfy some tool like the borrow checker, the tool should do the right thing and allow them to express their ideas in code with as little effort as possible.
评论 #15392503 未加载
评论 #15391093 未加载
评论 #15391254 未加载
评论 #15391085 未加载
评论 #15391287 未加载
评论 #15391090 未加载
tlbover 7 years ago
I wonder if the danger of C is something people like, deep down. I spent some time talking to people who do dangerous jobs, thinking about automating their jobs with robots. Most of them <i>liked</i> the danger. They enjoyed having mastered the art of not getting killed by falling tree branches, or live wires, or runaway trucks, or whatever the job involved. They felt satisfaction at doing a job where, if someone else tried to do it, they&#x27;d probably get hurt on their first day. You can imagine various ways this could have evolved in hunter-gatherer societies.<p>Most new languages are far safer than C. For some that&#x27;s the main selling point, for others it&#x27;s just a side-effect of having GC. I wonder if you could get a lot of traction with a language as expressive as Ruby, but with footguns galore. I&#x27;m not sure that space has been adequately explored.
评论 #15393484 未加载
mmjaaover 7 years ago
It shouldn&#x27;t be such a surprise, unless one is ignorant of a stable, decades old, computing maxim:<p>Old computers (and by definition, old computer software) never dies. <i>The users do</i>.
JacobiXover 7 years ago
Even in relatively new fields like machine learning, nearly every software that we use at work is written in C or is a wrapper around a C library, or in some cases in Fortran (a 60 years old programming language) : we use extensively PyTorch, torch, numpy, LAPACK, Scipy, etc.
tudorwover 7 years ago
PHP is having it&#x27;s 21st this year and is in use on around 200 million websites, I think it&#x27;ll make it :)<p>Logo is 50 :)
rbanffyover 7 years ago
The &quot;AHL&quot; name brings me fond memories of Creative Computing magazine and their editor, David H. Ahl.<p>Sadly these AHL&#x27;s are unrelated.
makecheckover 7 years ago
Binary compatibility is as much a reason as the language itself.<p>For C++ I remember spending years trying to carefully track compiler versions, precise build setup, etc. or your library would probably fail to link. I have never had a binary compatibility problem with a plain C library.
asnycover 7 years ago
C exposes you to low level programming environment, memory management and system internals. Its a great base to build upon for programmers. Even after more than a decade, I still have fond memories for K&amp;R C - a must read for programmers.
Veedracover 7 years ago
C was so successful because it had, and to a large extent still has, no competitors.
评论 #15394913 未加载
评论 #15393021 未加载
yellowappleover 7 years ago
&quot;We use git for source control. hg, largely written in Python, was started within a few days with the same goals. Who won?&quot;<p>I somehow doubt git&#x27;s popularity has a whole lot to do with it having been written in C.
walshemjover 7 years ago
So COBOL and Fortan is still going strong in the areas its appropriate for.
评论 #15392458 未加载
qwtelover 7 years ago
c.f. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Lindy_effect" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Lindy_effect</a>
jasonmaydieover 7 years ago
it&#x27;s time we admitted bad code isn&#x27;t because of the tools we use but a function of how we write code. You can write bad code even in &quot;safe&quot; languages. Leak memory with languages that come with a GC, etc etc.
评论 #15392708 未加载
faragonover 7 years ago
C is simple and beautiful.
评论 #15391297 未加载
评论 #15391043 未加载
评论 #15392805 未加载
评论 #15392427 未加载