21 ms·
The Resurgence of C Programming
- SteveWatson 10y agoWhy do I need to log in to read the article?
- deleted 10y ago[deleted]
- nickpsecurity 10y agoEither it's a glitch or you don't use NoScript. I got the whole article plus a message about all kinds of scripts blocked. :)
- hyperpallium 10y agoThanks; just turning off javascript works too.
- bluedino 10y agohttps://webcache.googleusercontent.com/search?q=cache:a48J53WyUzgJ:https://www.oreilly.com/learning/the-resurgence-of-c-programming%3Futm_source%3Dfeedburner%26utm_medium%3Dfeed%26utm_campaign%3DFeed%253A%2Boreilly%252Fradar%252Fatom%2B(O%27Reilly%2BRadar)+&cd=1&hl=en&ct=clnk&gl=us https://webcache.googleusercontent.com/search?q=cache:a48J53...
- wrx4me339s 10y agoDon't know why you need to. Works for me with uMatrix and uBlock Origin enabled.
- geospeck 10y agoYou can read the cached version of the article without log in. Here is the link: https://webcache.googleusercontent.com/search?q=cache:ItQkugX9F1QJ:https://www.oreilly.com/learning/the-resurgence-of-c-programming+&cd=1&hl=en&ct=clnk&gl=de https://webcache.googleusercontent.com/search?q=cache:ItQkug...
- erbo 10y agoMaybe it's time to revive this little ditty: http://www.poppyfields.net/filks/00259.html http://www.poppyfields.net/filks/00259.html
- catnaroek 10y ago> Some of the most popular and widely used software—like the Linux kernel, Apache HTTP server, and Google Chrome browser—are written in C/C++ What is this C/C++ language he talks about?
- d33 10y agoWhy would anyone choose C when Rust becomes mature?
- Mr_lavos 10y agoWhy would anyone use Rust when C++ is here and is already mature?
- sgift 10y agoI haven't used C++ in a long time, but ... can I still use standard language features (Templates) and my code will compile with one compiler, but not the other? That would be a big reason in my opinion.
- AlexeyBrin 10y agoGCC and Clang are 100% C++14 compatible, not sure about MSVC but I think it is close to 100% compatibility.
- mfukar 10y agohttps://msdn.microsoft.com/en-us/library/hh567368.aspx https://msdn.microsoft.com/en-us/library/hh567368.aspx
- gpderetta 10y agoWhy would that be a reason? There is still only one rust compiler.
- nickpsecurity 10y agoInterestingly, one can substitute Ada/SPARK for C in a lot of this article on "C's benefits" with huge boost on safety & maintenance side. For cutting-edge, one project on 8-bit micro's used ATS language for its combo of safety & performance. OcaPIC let's tinkerers use Ocaml subset for algorithms if performance doesn't preclude it. People are also getting a combo of high-level and C benefits by using DSL's embedded in eg Haskell that output C. The Atom, Ivory, and Tower languages are examples of this. The only thing that's uniquely an advantage of C in the article is understanding legacy code in popular projects. It's mostly in C for historical & social reasons. Mastering C is a great help there. Although, one could still use Ada (Ada-to-C compiler) or DSL approaches above with better results when writing code. Maintainers won't accept that in popular projects, though. So, back to knowing & writing good C for this sort of thing.
- ci5er 10y agoSo... Ada is better, and anyone could use it where they use C - and in fact could use it to generate C. But nobody does. Is that your point?
- nickpsecurity 10y agoThe point is that many benefits ascribed to C to justify use of C arent unique to C and therefore dont immediately justify it. Then I corroborate that with several examples including Ada. You got that much right. The nobody does part seems off given amount of customers companies like AdaCore have and how much is recurring business. Safety-critical industries like tools that help software work correctly from the start. A significant chunk, esp in aerospace, use Ada.
- Keyframe 10y agoThere was recently a discussion about Ada here and it seemed real nice with an obvious question - if it's so nice, why no one is using it outside of scope of people already using it. So, I gave it a try. Ada is a wonderful, WONDERFUL, language. Albeit a bit verbose. Here comes the catch though. Everything related to Ada seems to be tied to Adacore and proprietary toolings. There's a path for you to do it without (still tied to Adacore though), but not as obvious and not as widespread. Kind of like Common Lisp in ye olde Franz days. C is great too. C99 especially so. C11 threads are good too. C20 seems to be on a good path as well, here's its charter: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2086.htm http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2086.htm Only thing I would add to C as a language or in standard libraries is some kind of (better) string and UTF handling. ICU4C is coolio, but too much. Antirez's SDS looks cool, but I haven't used it, so I don't know from practice how/if it works with UTF and if it's great in production.
- jstewartmobile 10y agoGiven that clock speeds are pooping out, this makes total sense. Things already seem to be moving to an even lower level when performance really matters (shaders, FPGAs, etc). C looks fairly forgiving after implementing things in verilog. For the "why not X" crowd, the problem is that there are very few Xs out there with 30+ years of code to build off of. That, and it's almost a psychosis among us CS grads to overestimate the magic that "better" languages are capable of.
- nine_k 10y agoI don't hear much about performance problems causing major trouble in popular software and making everyone patch things in haste. For unsafe memory management errors leading to RCEs it's a different story. Guess what language are the patches usually in.
- jstewartmobile 10y agoNot everyone has the same usage case. For general user applications, yeah, performance isn't that big of a deal. That's not the entirety of computing though. Some people do things where performance is crucial. This is probably why Intel is moving into the FPGA space and Google is making their own accelerators for machine learning.
- sdegutis 10y agoIn fact, C (with SDL2) seems perfect for writing a retro video game. Memory leaks aren't usually a concern, because most memory is allocated up-front to save time and give very predictable and consistent performance. And most video game logic is very simple to do using simple functions, pointers, and structs, without the need for higher-level constructs like closures and GC which make a lot more sense for a mobile TODO-list app than for a video game. At least that's my experience, but obligatory disclaimer: I've never finished writing a video game (yet!) :D
- nine_k 10y agoAbsolutely. People who write games or audio / video software sometimes even do hand-written assembly fragments. The very high-performance things are a relatively narrow area, and an area where C can easily lose to e.g. Fortran. Also, for ML stuff you likely don't have a huge entrenched C codebase yet. You are freer to choose a more expressive language, and only hand-optimize / rewrite in C a small amount of hot paths.
- pklausler 10y agoArticle lost me in its first sentence: "Way back in the early 1970s, learning C was a rite of passage for many students." Nope. In the early 70's, all the world's C programmers were still in the same building. Try the late 70's, when many schools got their UNIX licenses, or the early 80's, when vendors were all doing their own PCC and UNIX ports.
- kstenerud 10y agoYup, because that little oversight invalidates the WHOLE article! Bravo! Another case closed, Dr Watson!
- ajross 10y agoIt's an article about writing C code for microcontrollers in the now-hip maker world, not a history lesson. Beyond the reference you quote, nothing from the Bell Labs era is treated at all.
- rb808 10y agoI keep changing my mind about C/C++. I loved my junior days programming in C & C++. It was really fun writing your own logging framework, container classes etc. OTOH spending weeks looking for root causes of memory problems was fun the first few years then became an annoyance. Higher level languages are much more productive - which was initially great, but now I feel more like a sysadmin than a programmer. Its a lot of researching, wiring up and configuring libraries. Probably results in better results but not as fun as hitting the metal. So sometimes I wish I could go back to the old days but my nostalgia is probably rose tinted. I'd love to do it, but I don't think its commercially productive enough, so I'm skeptical of talk of a resurgence.
- cryptarch 10y agoTry Rust maybe? It has a different learning curve from C, as initially you'll be having a hard time getting programs to compile at all, but from that point the ergonomics are much better and you don't ever have to deal memory bugs unless you're developing a low-level library.
- deleted 10y ago[deleted]
- echelon 10y agoI second this notion. I'm quite productive in Rust now and can string together web services quickly. (To date I've written a text to speech engine, a laser projector renderer, and some image processing stuff.) Rust is so awesome. Unlike Python or Ruby it's typesafe at compile time. Unlike Java and Go, it has no dumb GC, and unlike C and C++ it's memory safe. At compile time! Programs can be distributed as a single binary, which makes deployment a breeze. If that weren't enough, Rust innovates beyond every language I know of with its compile time threadsafety and fucking sweet package manager. (Cargo is seriously the best package manager I've ever used--perhaps the best in existence right now.) Give Rust a try. It's freaking awesome. (I'll buy you a coffee if you do and don't like it!)
- rb808 10y ago
- bluejekyll 10y agoMaybe I missed it in the article, but it alludes to this: C is the least common denominator. It's not a great language, but it works everywhere and will work in the most restricted of environments. As the article states, it's resurgence is bc of restricted small devices, but that's not because it's a great language. Debugging memory issues is horrible, having strange things happen because of randomness between compilers, no fun. I had a recent desire to get back to baremetal, but I didn't go back to C; I have too many battle scars. I went to Rust, and have never looked back or regretted it. The FFI between Rust and C is pretty easy too for any cases where I need it.
- CorvusCrypto 10y agoI have also been looking to get back into bare metal programming professionally (I miss the torture). Did you see an immediate switch to rust or is this a rare unicorn project in a sea of C/ASM code for embedded devices?
- bluejekyll 10y agoI've been writing my own ground up stuff. Nothing really on the hardware side for me to publish, but I have been writing a few articles on my DNS project which I have some plans for in the small device realm at some point (not free of allocations yet though). There are many articles by others out there for getting going with Rust on baremetal, and with Rustup it's now easy to cross compile from your Dev computer to the tartget device.
- CorvusCrypto 10y agofosho. Will look into those, but I guess my question is if it's worth practicing some development for embedded devices in rust to switch jobs or if most are still using C and I shouldn't waste the time. EDIT: if anyone can answer this that would be so awesome :)!
- kej 10y agoCompared to C, the number of employers looking for rust developers is so close to 0 that it's essentially a rounding error. I really like rust, and I think it's worth learning, but it is definitely in the early adopter stage and not something that has really made a dent in the embedded industry, let alone taken over.
- faragon 10y agoC is not going away because is useful, simple, beautiful, and has no problems on dynamic linking on most OSs.
- curiousgal 10y agoI wouldn't say simple. But I agree on the rest.
- faragon 10y agoWell, C is simple in comparison to its alternatives. By a long shot, in my opinion :-)
- naasking 10y agoWell then, I look forward to your argument supporting the use of Brainfuck or programming raw Turing tapes. Can't get much simpler than those options by your metric!
- fierycatnet 10y agoI think that it could be said that C is in fact simple but not easy.
- overgard 10y agoC has this mystique of being hardcore, but it's not really that hard. I actually think languages like Ruby are more difficult because they hide so many (important) details from you. I would agree that C can be inconvenient, but its not hard.
- Vindicis 10y agoC's syntax is simple, sure. But there's so many little things that can bite you in the ass very easily, which is why most people think it's hard. For production code, if you don't have a copy of whatever standard, and aren't able to use that to find your answers, you shouldn't be working on that code. Think of it like this: In python you could be a beginner, and still write effective code to accomplish your goal. And while it might be slow, you also avoid having deal with a great many subtleties, which in C, to write code for a similar function, you could very well need to be high-intermediate to write the same bug-free code. Faster? Most likely, but if it's error-prone, does speed really matter? That's my belief anyway, ymmv.
- elcritch 10y agoTo reinforce this, I still believe C is one of the most elegant syntax's for a "portable assembler". There are many dark corners of C, take for example pointers: https://kristerw.blogspot.com/2016/03/c-pointers-are-not-hardware-pointers.html https://kristerw.blogspot.com/2016/03/c-pointers-are-not-har...
- bogomipz 10y agoThis is an interesting read, thanks. However I do not understand the opening sentence: "Pointers in the C language are more abstract than pointers in the hardware, and the compiler may surprise developers that think that pointers in C work in the same way as pointers in the CPU." What are pointers in the hardware? I am not sure what is being said. Any ideas?
- cesarb 10y ago
- buserror 10y agoI love C, I really don't see what the fuss is about about 'replacing' it really. It's a sharp tool, requiring care and attention. I did C++ for about 20 years, and gradually reverted to C, simply because of the footprint and the ease of maintaining a C codebase compared to a C++ codebase. C++ codebase's footprint will /explode/ very quickly, while it's really, really hard to do that with C. You can't have 'shockwave' effects in C codebases; you can't have an intern adding a subtle 2 liner to your codebase in an obscure base class and make the footprint of your application explode. (been there...). It's a lot easier to review, test and maintain over a number of years. Also, I've grown up considerably since I believed object oriented programming is THE way to solve everything related to programming problems, I've seen a lot of cases where you'd have a spaggetti plate of classes to solve a problem while you in fact could have solved that problem in a 15 line static function. C -- especially C99 with it's extensions -- is nice, lightweight, hard to mess around with. it's actually a sharp tool but at least it's a straight sharp tool. You know where it's going and how it can hurt you. It's not the case for many of the other solutions who just add bloat to try to hide the fact that they are about as sharp cutting, but it'll get you at the back of the head, later :-) I keep a keen eye on what's going on with Rust and Go in particular, but it'll be a long time still for me to commit to any of the new kids on the block. Right at this minute I imagine myself easily having to rage-recode it in C at some critical point because of some unforeseen effect. My only regret with C is that the C committee is completely out there. C11 doesn't solve any of the problems that would be useful for 99% of C programming. Like, rolling in some of the GNU extensions that have been around for 25+ years (case X...Y comes to mind!)
- Manishearth 10y ago> I really don't see what the fuss is about about 'replacing' it really. It's a sharp tool, requiring care and attention. I really like the take on the "sharp tools" analogy here: https://www.schneems.com/2016/08/16/sharp-tools.html https://www.schneems.com/2016/08/16/sharp-tools.html . Your tool might be sharp, but that doesn't mean that you can't make it safer to use.
- PavlovsCat 10y agoThat thing looks like it could kill a man if dropped from sufficient height. On the other hand, if I envision it without a case, I'm still not seeing a terribly dangerous object. > This design is an evolution of planes over centuries of use How did early ones look like then? Was getting hurt by them a problem, at all? I'm not debating that main point, that in many cases, safety and usefulness are orthogonal. But that example is kind of worse than none.
- jstewartmobile 10y agoWhenever C gets brought up, people are like, "pointers... memory... dangerous!" In 20+ years of C, I've never had a (self-inflicted) problem in that area. Maybe I'm the rain man of bit-twiddling? What has caused me tremendous grief are all of the inconsistencies in the compilers, the gotchas of the precompiler, and the ambiguities in the language itself. C++ is even worse. Rust is great, but not great enough to justify a redo of a program that has been extended and maintained for decades (like vim or photoshop). I think an iterative tightening of the language would be of greater utility to everyday computing than a rush to re-do everything in something "better."
- faragon 10y agoAlso, there is the risk of re-doing everything and getting worse results: e.g. executable/library bloat, code harder to read/understand, interoperability/binding issues, etc.
- psyc 10y agoI agree with you. I've been a C and C++ programmer for decades, and nothing to do with memory safety or leaks has ever risen to the level of prohibitive or even annoying. Ironically, I've had infinitely more grief from fighting hostile garbage collectors, but that's because I'm a game programmer. I quickly dropped Rust upon realizing that the core of the language addresses problems I don't have. I'm always met with strawman arguments about how I can't possibly write "correct" code. It's a strawman because I don't claim to write correct code. I don't care if Herb Sutter can find 1000 "bugs" in my C++. I care that my users and myself are happy.
- agumonkey 10y agoI still don't really know how to think in C. After long FP fanatism say, I ended up understanding more low level patterns through recursive to iterative techniques, shedding light on how to design imperative patterns. Then stack reducers, and Forth threaded code. All bringing a bit of safety and bounds to the LoC. But I'm still not sure how to design in C.
- Sir_Cmpwn 10y agoC is my favorite programming language, out of the half dozen or so I have advanced to expert knowledge of. It's the best of the lot by a wide margin.
- dmitrygr 10y agoIs it that amazing how best tools for any given job keep resurging no matter how many times people try to replace them? Turns out that for many jobs C is simply the best language. Memory limited? C CPU limited? C No OS? C Need precise-ish control of executed code? C Want inline assembly you can integrate with? C New chip/architecture? C Predictable performance? C Hm, not surprising after all :)
- fierycatnet 10y ago"Write in C" https://www.youtube.com/watch?v=1S1fISh-pag https://www.youtube.com/watch?v=1S1fISh-pag
- colemickens 10y agoExcept Rust has all of those with significant improvements to the type system, safety and library/package ergonomics. I don't use the word "significant" loosely here at all either.
- dmitrygr 10y agoWhen you can fit a rust program that works as a voice-changing dictaphone into 1K of flash on a Cortex-M0, get back to me
- bandrami 10y agoC was designed in a time when codebases were much, much smaller than codebases today; when your project got big enough that it was unwieldy for C you embedded a lisp or TCL interpreter and used that to string together small C utilities. As I Get Older™, I'm starting to agree with the Suckless[1] people that the small-project way is better, and that one of the reasons it's better is that C still works for it. Projects that are small enough for a single developer to understand in the nature of things have fewer problems. Yes, that would mean a change in what we expect software to do and how we expect it to behave, but that changes all the time anyways, and I think a pendulum swing back in the minimalist direction would be a good thing. [1] http://suckless.org http://suckless.org
- kazinator 10y agoAt one point, there was a pejorative in circulation among some programmers: "hugeware". It seems to have been forgotten. We seem to have developed a kind of "hugeware acceptance". What was dubbed hugeware was actually small by today's standards.