Having used both extensively, I can tell you that it is much more difficult to write slow, bloated, overly complex code in C than in C++. It keeps you honest in that way. Also, most of the good things of C++ such as object-oriented programming and templating can be done at a basic level in C. For example, in C++, a class function is just an ordinary function with a hidden pointer to a (class) structure. Why not just pass in a pointer to a class structure in C? And class member privacy can easily be a m
It's been ages since I read Stroustrup or Kernighan & Ritchie, as I have largely moved on from embedded/Unix programming into Web based systems but I seem to recall one of the arguments for using C++ was that it could always do things as efficiently as C and possibly more so.
Likely true, but the benefit of C that I'm highlighting is that it gives you very little rope to hang yourself with in terms of creating a system composed of layer-upon-layer of classes. In contrast, I once worked with someone who loved to create class-upon-inherited-class for the simplest things in C++. Everyone who looked at his code wondered "where's the beef?", that is, the part that did something useful. The code worked, so the useful part must have been in there somewhere. But it sure wasn't easy
According to all the latest reports, there was no truth in any of the
earlier reports.
Given that (Score:2)
C++ is more or less a superset of C (give or take a few minor issues [wikipedia.org]), why has regular C continued to thrive?
Re: (Score:1)
Having used both extensively, I can tell you that it is much more difficult to write slow, bloated, overly complex code in C than in C++. It keeps you honest in that way. Also, most of the good things of C++ such as object-oriented programming and templating can be done at a basic level in C. For example, in C++, a class function is just an ordinary function with a hidden pointer to a (class) structure. Why not just pass in a pointer to a class structure in C? And class member privacy can easily be a m
Re:Given that (Score:1)
It's been ages since I read Stroustrup or Kernighan & Ritchie, as I have largely moved on from embedded/Unix programming into Web based systems but I seem to recall one of the arguments for using C++ was that it could always do things as efficiently as C and possibly more so.
Re: (Score:1)
Likely true, but the benefit of C that I'm highlighting is that it gives you very little rope to hang yourself with in terms of creating a system composed of layer-upon-layer of classes. In contrast, I once worked with someone who loved to create class-upon-inherited-class for the simplest things in C++. Everyone who looked at his code wondered "where's the beef?", that is, the part that did something useful. The code worked, so the useful part must have been in there somewhere. But it sure wasn't easy