#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    34
    Rep Power
    14

    Why do people still code c?


    If c++ is a lot better?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Interestingly, I asked this same question to an uncle of mine, who's a prof in a univ. in california. This was a few years ago, so impressions may have changed now. Anyway, he was talking about this experimental satellite that some of his students were working on and it used an 80186 chip IIRC. He told me that the software was being written in C, because the consensus at a certain propulsion lab was that C++ was not quite a mature language as C.
  4. #3
  5. Happy Monkey
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2001
    Location
    UK (University of Kentucky)
    Posts
    1,809
    Rep Power
    47
    Most Linux software is written in C.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Bangalore, India
    Posts
    13
    Rep Power
    0
    C provides a better oppurtunity to play with pointers
    Best Regards
    Nitin Mathur
  8. #5
  9. Left due to despotic ad-min
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Posts
    1,044
    Rep Power
    14
    Most people stick with C because that's what they know. For them, C++ may be overkill and involve too great a learning curve. C++ is a much larger language than C, and therefore more difficult to learn well (although I'd argue both C and C++ are large languages that are difficult to learn well).
  10. #6
  11. No Profile Picture
    .
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    296
    Rep Power
    12
    it's just quite a base / core language used all over the place. a great starting point i think. c++ is one direction out of many you could go in, from c. personally i'm going in an objective-c direction from c: i don't plan on touching c++ at all.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    9
    Rep Power
    0
    'better' depends on the problem you are trying to solve - some problems lend themselves to an object oriented design that C++ can solve, some lend themselves to more 'traditional' designs, that standard C can solve. Large applications can be written in C (take a look at the Linux kernel, that's a pretty hefty lump of C code).

    Some people also prefer to code in C over C++ because they view C++ as an ugly hack on top of the simple language that is C - I don't know C++ so I won't take that point any further :)
  14. #8
  15. DNS/BIND Guru
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2003
    Location
    OH, USA
    Posts
    4,266
    Rep Power
    173
    When you're going retro C is for you. What I mean is this. Visual Basic was the first language I learned, but I was very dissatisfied once I knew better with its inefficiency. I started to try to learn Visual C++ but the GUI itself disgusted me. I grew fed up with the entire thing, and wanted to scratch out my programs in notepad. I went for C cause it does not pamper you. I wanted to learn the low-level of things. I wanted to "play" with pointers and memory chunks as they really are. When you get that kind of understanding of the architecture, you become more familiar with what is the fastest way to execute a task. And what takes the least amount of code.

    People who code in higher level languages are mostly concerned with getting a project done, in the shortest amount of time, with the smallest amount of effort. People who STILL and do code in C are frequently primarily concerned with HOW a project is done.

    This is also why most linux programs are written in C. Cause the same type of person values linux, as those who value C.

    It does not matter if you can code C in a C++ program. Cause those type of people don't WANT any of the functionality C++ provides.

    And when you get as efficiency fanatic as I am, you desire to pump out things in ASM as well.
  16. #9
  17. No Profile Picture
    status unknown
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    262
    Rep Power
    12
    Don't forget, there's a lot of existing C code out there, and a lot of very experienced C programmers. And C as a language continues to develop.
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    34
    Rep Power
    14
    hasnt c++ been around for a while
  20. #11
  21. No Profile Picture
    status unknown
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    262
    Rep Power
    12
    Originally posted by foe
    hasnt c++ been around for a while
    Yes it has, and similarly, lots of people still use C++ ;-)
  22. #12
  23. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by foe
    hasnt c++ been around for a while
    Originally posted by BigBadBob
    Yes it has, and similarly, lots of people still use C++ ;-)
    Yes, the same as with COBOL. Which leads us to legacy code as a reason for still using C.

    A lot of a programmer's work lies in maintaining existing software. Such legacy code is almost invariably written in older languages and using older techniques. When you are given the task of fixing a bug or adding a feature to legacy code, you almost never are afforded the luxury of rewriting the entire thing using the latest language nor the latest tools. And if the Y2k panic taught us nothing else, it taught us that the amount of really old legacy code being used out there is much greater than we realize -- such as all that decades-old COBOL code that had us scared.

    Similarly, when you are given a new program to write or a new embedded project to design, you are often told by management (or you even suggest it yourself) to base it on an existing program or device that appears to do something similar. Which yet again leads you into using older technologies and older languages.

    Plus, some older wisdom continues to exist even though it may no longer be true. For example, C was always chosen over C++ in embedded projects mainly because C++ placed extra demands on the hardware (especially in the amount of RAM required) that were just plain more expensive. But now that larger amounts of RAM are much cheaper and much more powerful processors are available for embedded projects, the old wisdom is not necessary true anymore. Yet it persists.

    Then there's the "old programmer" effect, in that there are programmers with decades of C experience but who have not learned C++. So in a brand-new project, their choice for the language will naturally be C, not C++. In the same way that many "revolutions" are won in many fields -- the young generation with the "revolutionary" ideas win when the older generation dies off --, the newer generation of programmers who are taught C++ instead of C (though they must learn C OJT) must wait for the old programmers to die off or retire before they can choose the new projects' language -- and then they'll have to contend with the new generation of young upstarts pushing yet another new language.

    And finally, there are some jobs for which C is the better choice. OOP is great for organizing a large project, but for some small projects it would be over-kill. Plus the project may require smaller faster code, which C is better at delivering than C++ is.

    Just my two cents worth, offered more because I couldn't sleep.

    A tagline I encountered on a newsgroup or forum:
    Instead of asking why a piece of software is using "1970's technology", start asking why software is ignoring 30 years of accumulated wisdom.
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    34
    Rep Power
    14
    so your saying c is faster than c++?
  26. #14
  27. No Profile Picture
    status unknown
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    262
    Rep Power
    12
    Originally posted by foe
    so your saying c is faster than c++?
    I think it would be difficult to make a general case one way or the other.
  28. #15
  29. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    Depending on what the program is going to be doing, then C can be faster than C++. Both languages have thier uses and where they have an advantage in. Typically projects that can really take advantage of OOP are done in C++. Just for example look at a spreadsheet. Each cell on a spreadsheet would be an object. Doing this in C++ would be a lot easier than doing this in C.
    I find myself using C more than C++ though, mainly because of what I use C for. Which is building applications that run on barcode scanners. These apps must be fast and have a small footprint. This, to me, is easiest done in C than C++. Although I do agree with what dwise_aol posted in that there are multiple reasons why one language is used over the other. To me, it mainly boils down to C was not made extinct by C++ (or any derivitave of C for that matter) because it still usefull and will remain to be so for years to come.

IMN logo majestic logo threadwatch logo seochat tools logo