3 ms·
... meanwhile the entire Internet is powered by software written in C, including the very same browser you typed this message in. I've been hearing how obsolet
by tx 18y ago
... meanwhile the entire Internet is powered by software written in C, including the very same browser you typed this message in.
I've been hearing how obsolete C is ever since high school (1994) yet pieces of successful programs not written in C-family is an order of magnitude less common: everything form web-servers to browsers, OSes and office suites and imaging software - all C. Meanwhile I've never had to install JVM on any of my computers, somehow I never run across a single piece of useful software written in Java (with exception of evaluating Jython and toying with Eclipse&Netbeans at work).
Perhaps it's running on my phone. If so, that's probably why the damn thing feels so anemic compared to Objective-C powered iPhone.
I don't know how C programmers do it, but somehow they just get things done.
Moreover, C remains the only choice of writing the most portable code ever. There isn't a reasonably popular CPU on this planet that doesn't have a C compiler for it, while Java runs only on "java computers".
- jrockway 18y agoC is entrenched. Everyone uses it, and because everyone uses it, everyone continues to use it. That doesn't make it good, though, just popular. Read pg's "Beating the Averages" for a more eloquent explanation. You seem to think that Java is C's competition. It's not. I think we can all agree that Java is one of the worst programming languages ever created. (The VM is nice though.) Nobody is telling you to use Java or C++. They are telling you to use a dynamic language (Perl/Python/Ruby) or a functional language (Haskell/OCaml/Lisp). I don't know how C programmers do it, but somehow they just get things done. Sure, but their programs usually leak memory (ever use Firefox?), and their libraries handle errors by terminating the whole program (see PulseAudio; any error condition immediately calls exit(1)). There isn't a reasonably popular CPU on this planet that doesn't have a C compiler for it, while Java runs only on "java computers". I don't optimize my life for solving problems I don't have. Every machine I want my code to run on has Perl, Lisp, Haskell... whatever. If C was the highest-level language I could use, then obviously I'd use it. But it's not, so I don't. Finally, gcj will compile Java down to machine code; ghc compiles Haskell to native code. So I don't ever see a situation where I will absolutely have to use C for some reason (other than interfacing with C libraries, of course).
- jey 18y ago"Sure, but their programs usually leak memory (ever use Firefox?), and their libraries handle errors by terminating the whole program (see PulseAudio; any error condition immediately calls exit(1))." That's a poorly written program. You can just as easily System.exit(1) in Java, or to do it a more Javaesque way, throw new Error("im too lazy to do this right").
- jrockway 18y agoBut C doesn't have any mechanism other than exiting or returning a value that indicates "false". Both are non-optimal. One (exit) makes the code simpler, but makes the consuming application extremely flaky; the other bloats the code with a weird API where functions modify their arguments: errorcode_t do_some_work(int arg1, int arg2, int *result) and forces the client code to check every single error and decide right then and there what to do. It's possible to write code that way, but why would you want to? This is a solved problem; why keep using a square wheel when round ones are available? (Yes, there is longjmp. Still a lot of work to use that square wheel.) In the end, don't think I care what programming language you use. It doesn't matter. But I do think that C should be dying off now; it is much less useful than it was 30 years ago.
- huhtenberg 18y ago> But C doesn't have any mechanism other than exiting or returning a value that indicates "false". Of course it does, in fact you just said it yourself - long jumps. Back in late 90s I worked with the firmware for the Point of Sale terminals, PIN pads, etc. It was written in C and its error handling was exception-based. Behind the scenes it was just a handful of long/setjmp wrappers, but it did nevertheless implement semantics of try/catch/etc. Additionally, "exiting or returning false" are not the only two options, nor they even the most commonly used ones. At least in the projects that I was exposed to. Kernel code (e.g. Linux, BSD) routinely uses int as a return value and it still somehow manages to be both readable and functional without being "bloated" or using "weird API". Yet another thing to consider is that optional exceptions (such as those in C++) come with a non-negligible performance hit, so it is considered an absolute no-no to use them in a "fast path" parts of the code. > But I do think that C should be dying off now But it just doesn't. Bummer :)
- st3fan 18y ago"""I've been hearing how obsolete C is ever since high school""" C will not be obsolete for a very long time. It is however completely silly to compare it with Java. Completely different and created for different purposes.
- wheels 18y agoNone of the modern browsers, unless we're counting Epiphany, are written in C, and it uses a C++ rendering engine. Safari is an Objective-C / C++ mix, Firefox, Flock, Camino, Konqueror and IE are C++.