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?

9 of 641 comments (clear)

  1. Very relevent for small target embedded stuff. by Ihlosi · · Score: 5, Informative

    C is the high-level language there. If you want actual control over your target, you'll need to use assembly.

    1. Re:Very relevent for small target embedded stuff. by aralin · · Score: 4, Informative

      The thing is, if you use structures with bit fields, C will not optimize the manipulations with them correctly. So you end up doing a lot of hand-holding in driver development in C. You have to be very much aware of the code being produced. It is not uncommon that you check specific inner loop sections to see exactly how they are being compiled and then based on the result and number of instructions might need to rewrite the C part or even just insert the assembly code directly.

      --
      If programs would be read like poetry, most programmers would be Vogons.
  2. C had no real successor by Anonymous Coward · · Score: 3, Informative

    Is there another OS/system programming language that is universally accepted as a reference, rather simple to learn, available on virtually any OS, real fast? I mean, go is nice and multi platform and powerful, but it is not even close to C popularity.

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

  3. Libraries by heikkile · · Score: 5, Informative

    If you write a good useful library in C, it can be used from almost any other language, with little effort. If you write your library in any other language, you limit its use to a handful of related languages. Also, properly written C can be very portable to a wide variety of systems.

    --

    In Murphy We Turst

  4. Re:C++ is C by luis_a_espinal · · Score: 4, Informative

    I was and still am a pretty accomplished C prorammer, and can find my way in assembly. Then C++ came along and everybody seemed to jump on that bandwagon. I couldn't and many of my collegues either. When you have progressed to far along the procedural path, it seems to be impossible to wrap your head around the object oriented paradigma. That is why I also never got into Java.

    Paai

    You need to progress through modular programming and abstract data types. Then OO makes a lot of sense. Well written, highly modular C code with good abstractions tends to resemble well-written C++ without operator overloading in my experience.

    Hell, well-written modular programming resembles well-written OO programming (since the later can be seen as a natural extension... or conclusion of the former.) Well-written procedural code must exhibit characteristics of modular programming.

    What happens with C++ (specially at the beginning of its development) is that everybody tended to use every single goddamend feature, abusing operator overloading (and later templates). So C++ became "equivalent" to "overloading gotcha and magic-behind-the-curtains" soup smeared over a tangle of classes in an inheritance tree from hell (in many ways, not dissimilar from Java at the beginning with its own gotchas.).

    One can program clean C++ with very simple semantics, using operators to the bare minimum, using templates judiciously, knowing when to use virtual and always implementing the big three (default constructor, copy constructor and = operator.)

    If you can modularize your procedural code and how to layer your abstractions, then you know how to split your code into modules and classes. You know how to encapsulate and delegate responsibilities. That is key for developing cleanly in C++ (or Java or C#... or in any language for that matter.)

  5. Re:C is very relevant in 2014, by petermgreen · · Score: 3, Informative

    I would argue that it is better to learn to write decent code than to let the language protect you from the effects of bad code.

    I would argue that there is a middle ground. C++ still lets you do the low level stuff when you need to but also provides higher level structures that when used responsiblly make code clearer and less error prone.

    --
    note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  6. Re:You don't know C++ properly until you know C by jeremyp · · Score: 3, Informative

    " don't really seem to understand the difference between pointers and C arrays"

    Well, because there isn't one at the language level. The array syntax using square brackets is only a syntactic sugar for pointer arithmetic, nothing more.

    There is a difference between an array and a pointer.

    char a[100];
    char* b;

    b = a; // Fine
    a = b; // Not fine.

    If you read the standard, the language used is that, in an expression, an array "decays" to a pointer with the rule being that you get a pointer to the array's first element. The "array is not a pointer" rule is further demonstrated by passing an array to sizeof (as viol8 points out).

    --
    All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
  7. It all goes back to ALGOL by Ottibus · · Score: 3, Informative

    "C++, Objective-C, Perl, Python, Java, PHP, C#, D and Go all have block syntax that's derived from C"

    And C got the block syntax from B which got it from BCPL which was a simplified version of CPL which was influnced by the first block structured language, ALGOL.

    I was taugh ALGOL at University, though I had already been "mentally mutilated beyond hope of regeneration" by BASIC before that...

  8. Re:C is primordial by Anonymous Coward · · Score: 2, Informative

    Take for example the JS expression $("a").addClass("blue").

    That's not even Javascript.