Slashdot Mirror


How Relevant is C in 2014?

Nerval's Lobster writes: Many programming languages have come and gone since Dennis Ritchie devised C in 1972, and yet C has not only survived three major revisions, but continues to thrive. But aside from this incredible legacy, what keeps C atop the Tiobe Index? The number of jobs available for C programmers is not huge, and many of those also include C++ and Objective-C. On Reddit, the C community, while one of the ten most popular programming communities, is half the size of the C++ group. In a new column, David Bolton argues that C remains extremely relevant due to a number of factors including newer C compiler support, the Internet ("basically driven by C applications"), an immense amount of active software written in C that's still used, and its ease in learning. "Knowing C provides a handy insight into higher-level languages — C++, Objective-C, Perl, Python, Java, PHP, C#, D and Go all have block syntax that's derived from C." Do you agree?

19 of 641 comments (clear)

  1. Embedded Systems by Anonymous Coward · · Score: 4, Insightful

    Those widgets the clueless newspaper reporters and marketers call 'the internet of things', otherwise known as embedded systems, depends on Linux and C. So therefore C is 'the next big thing'.

    1. Re:Embedded Systems by Tom · · Score: 5, Insightful

      and the people who do use C are not interested either since they tend not to be language fetishists.

      This. Half of the newer high-level languages today are just the mental masturbations of someone who either thinks he can make the wheel more round or the result of a "not invented here" mindset. There's so much crap out there forking a perfectly good language because someone thinks it should be a =+ b; instead of a += b;

      It's sickening, and a good reason to stay away from all this shit, because five years down the road someone will fork the fork and you can throw all your code away because support and development just stops as all the ADD kids jump at the new toy. That'll never happen with your C code.

      --
      Assorted stuff I do sometimes: Lemuria.org
    2. Re:Embedded Systems by chuckinator · · Score: 4, Insightful

      I agree with PP and GP, but there's more to it than just that. Software is like an organ of your computer; your computer typically won't do much worthwhile if there's not a whole bunch of the things working together to make complete systems. Almost every one of the higher level languages are implemented in C at some point in the software stack. Some might argue that certain JVM languages like Scala and Groovy and Clojure are written in pure java, but guess what? The JVM is written in C. Almost every piece of software out in the wild is either written in C or depends on critical components written in C all the way down to the operating system. If you're running embedded, you might not have an OS, but you probably should be using C on microcontrollers and embedded systems unless there's a real good reason not to.

    3. Re:Embedded Systems by phantomfive · · Score: 3, Insightful

      It's sickening, and a good reason to stay away from all this shit, because five years down the road someone will fork the fork and you can throw all your code away because support and development just stops as all the ADD kids jump at the new toy. That'll never happen with your C code.

      This is one good reason I program in C.
      The other reason is portability. You can write something in C and it will run on every major platform and almost every embedded platform. Furthermore, it is portable between languages. If you write a library in C, people can call it from C#, Java, Python, TCL, Ruby, or nearly any other language. It is the lingua franca of programming.

      --
      "First they came for the slanderers and i said nothing."
  2. Re:C is primordial by Anonymous Coward · · Score: 1, Insightful

    With C you can be OO, but you can also be nearly ML. And you can do them at the same time.

    Nearly lost my coffee... it is hard to figure out your point of view. If you use ML to mean machine language, and not the language ML, you must be quite old or quite young... if you think C is close to machine language, you can't be that old, but if you classify C as OO as anything more than in a rudimentary way, you can't be that young....

  3. C is very relevant in 2014, by Beck_Neard · · Score: 2, Insightful

    Because it's extremely dangerous and a lot of people are still using it. The 'standard' standard library is so full of security holes it's not even funny, and attempts to 'improve' it over the years have mostly been unsuccessful because the bad coding patterns still exist.

    C is a great language, it's just that most humans are incapable of using it safely and securely. It's like a .45 with a downward-pointing barrel. It's all too easy to shoot yourself in the foot.

    For full disclosure, I used to be an avid C programmer, until I realized the harm I was causing myself and others. It's like when you drunk drive and think you're just fine. It takes an external perspective to realize how reckless your behaviors are.

    --
    A fool and his hard drive are soon parted.
    1. Re:C is very relevant in 2014, by gweihir · · Score: 4, Insightful

      C is not a tool for the incompetent (whether temporary due to alcohol or permanently). It is an expert-only tool. There are a few of those around and they will stay around, because in the hands of somebody skilled, these tools deliver exceptional results that no more generally usable tool can match.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  4. Here be monsters by luis_a_espinal · · Score: 3, Insightful

    C++ is C

    I used to believe in this until I had to work on both. Although one can compile best-practice C with a C++ compiler (sans the gotchas), that glosses over the idiosyncrasies of each language. C does not have initializers as in C++.

    More importantly, it does not have references, type-safe casting operators and its template language is not turing complete as in C++. These differences will never go away, and these differences alter completely the type of design and implementation of your code and your abstractions.

    Not to mention the C++ rules of PODs versus everything else which affect how we link C code with C++ code (and viceversa.) And modern C++ heavily uses templates in manner that makes the language resemble something else entirely. Whether that is a good thing is highly subjective, but whatever.

    So from a practical point of view, it is sane to treat both languages as fundamentally different.

    When we program in a language (be it Ruby, Java, C or C++ or whatever), we ought to do so in the idiomatic way that naturally exploits the best capabilities of the language. So with that in mind, we cannot treat C and C++ as the same language (and it is not quite accurate to compare modern C++ as a superset of the former, regardless of historical evolution.)

    I do believe, however, that is very important, if not fundamental, to understand C semantics to use C++ effectively. The fundamental semantics behind the primitive types and control structures remain more or less the same. And I've always found that C++ programmers without a good background in C tend to make certain mistakes when they need to operate with pointers (since they are so used to work with references.)

    Furthermore, integration of C with C++ is not an uncommon task, and development of C++ code with that in mind is paramount. It is very hard to do that without a good understanding of C.

  5. Relevant to what? by aglider · · Score: 1, Insightful

    To mobile application market? Irrelevant.
    To online web services? Not so relevant.
    To online web server? Very relevant!
    To high efficiency applications? It's almost the standard.
    To operating systems? There's almost nothing other than C (in terms of market share).

    Please, elaborate more on your stupid question, you insensitive mobile clod!

    --
    Sent as ripples into the electromagnetic field. No single photon has been harmed in the process.
  6. Re:Very relevent for small target embedded stuff. by mean+pun · · Score: 4, Insightful

    .. or at least people who think they are clever. Occasionally they are right.

  7. Re:The third worst thing to happen computer histor by whimdot · · Score: 3, Insightful

    I have written embedded Pascal. Never ask me to do it again.

  8. Re:C is primordial by rioki · · Score: 4, Insightful

    Ok I will bite. Now I don't claim that C is on the same level than ASM, but you need to compare it to current languages. Languages like Python or JavaScript, they abstract out almost everything about the machine you are running them on. With C you program against a reasonably close abstraction of the real machine. In many cases you can hand compile the C code to ASM.

    Take for example the JS expression $("a").addClass("blue"). This expression written in C would take up something around 100 lines of code, simply because the machine you program against does not understand high level concepts. Even simple concepts like a string are not understood by C.

    I love programming in C, but in whole ecosystem of languages it is on the low end.

  9. Re:Very much so! by Rei · · Score: 3, Insightful

    I have issues with that notion, though. There's this popular perception among hardcore C programmers that C++ is "C with objects", and since they don't like or don't feel the need to do object-oriented programming, it's pointless for them. But C++ is a thousand times more than "C with objects". And even when it comes to objects, the most important ones aren't the ones you make yourself, but STL. Especially with the latest versions of C++. I just recently had to downgrade a simple app from C++11 to C++03 to support old compilers, and my god, I had forgotten what a royal pain pthreads are versus std::thread with a lambda argument. And if I had been forced to go all the way down to C, and thus would lose the std::list that simplified holding the threads' arguments. It would have been a page or two of code for what's a single line in C++11. And with far greater proclivity for bugs.

    I once was one of those "hardcore C programmers" who just saw C++ as "C with objects", and deliberately avoided using it and learning any more than I had to. But the more I learned, the more I came to appreciate it. I do of course make and use my own objects... but that's not really the most important aspect of the language. It's all of the countless features to automatically manage memory, data structures, ensure program correctness, and vastly reduce pointless verbosity that make C++ so important.

    --
    "We consider that six courts and an asylum claim are a rather odd way of returning to Sweden within a month."
  10. Re:C is primordial by mooingyak · · Score: 2, Insightful

    OOP is a style, not a language feature. Sure many languages make this easier to do, but writing OOP in C is certainly possible, as many of us can attest.

    --
    William of Ockham had no beard. The most likely explanation is that it was chewed off by squirrels every morning.
  11. Re:Very relevent for small target embedded stuff. by TheRaven64 · · Score: 4, Insightful

    The clever people use C when C is the right tool for the job and use something else when it isn't. The rest use C, Python, or whatever else their favourite language is, irrespective of whether it's the right tool.

    --
    I am TheRaven on Soylent News
  12. Re:C had no real successor by Rei · · Score: 2, Insightful

    C++ should have been C successor, but it is too complex to be.

    C++ is no more complicated to use than C. You can write C code in C++ and it'll work just fine, with only a few rare exceptions.

    What C++ does give you is many more capabilities. Now, if you don't want to take the time to learn these capabilities, that's not the language's fault. There's a few things that were implemented a bit awkwardly (mainly looking at you, streams), but the vast majority is quite simple and straightforward, and it just keeps getting better and better (check out the capabilities of C++11 if you haven't yet - auto declaration types, inline threading, for-each looping, smart pointers in STL, and on and on... really, really nice).

    If you don't like a particular part of C++? Don't use it. But that's no excuse to use "C-only". Want to use printf instead of cout? Go right ahead. But dammit don't do your own memory management when you don't absolutely have to, or your bugs are going to screw over the rest of us when we use your software.

    --
    "We consider that six courts and an asylum claim are a rather odd way of returning to Sweden within a month."
  13. Re:Very much so! by jlar · · Score: 4, Insightful

    But C++ is a thousand times more than "C with objects".

    I believe the above quote speaks for itself...

  14. Re:Very much so! by Bent+Spoke · · Score: 3, Insightful

    This may be true for new code, but when maintaining C++ code written by others, not so much. Everyone has a different set of "features they like".

  15. Re:Si. by cheesybagel · · Score: 3, Insightful

    Even if you mostly program in other languages eventually you need to interface with some system function or legacy library and you *will* need to use C.